From da4684ff1cd918b9ddf4c22f7f97930148c5b78e Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Tue, 26 Jan 2021 17:18:59 +0300 Subject: [PATCH] LU-14370 quota: use dt_sync() to flush pending writes and find remaining quota. Fixes: 18cd3e1e28 ("LU-12702 quota: wait pending write before acquiring remotely") Signed-off-by: Alex Zhuravlev Change-Id: I8f1ec334a1d1eefc385d8c6ef451de8a3f12365f Reviewed-on: https://review.whamcloud.com/41322 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: Wang Shilong Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/dt_object.h | 19 ------------------- lustre/osd-zfs/osd_handler.c | 10 ---------- lustre/quota/qsd_handler.c | 2 +- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 0330989..5cc8b26 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -298,17 +298,6 @@ struct dt_device_operations { struct dt_device *dev); /** - * Wait pending quota update finish - * - * There might be a window that quota usage has been updated, - * but commit callback to reduce pending write have not been - * finished, this is used to wait all pending update done. - * - * \param[in] dev dt device - */ - void (*dt_wait_quota_pending)(struct dt_device *dev); - - /** * Start transaction commit asynchronously. * @@ -2731,14 +2720,6 @@ static inline int dt_ro(const struct lu_env *env, struct dt_device *dev) return dev->dd_ops->dt_ro(env, dev); } -static inline void dt_wait_quota_pending(struct dt_device *dev) -{ - LASSERT(dev); - LASSERT(dev->dd_ops); - if (dev->dd_ops->dt_wait_quota_pending) - dev->dd_ops->dt_wait_quota_pending(dev); -} - static inline int dt_declare_insert(const struct lu_env *env, struct dt_object *dt, const struct dt_rec *rec, diff --git a/lustre/osd-zfs/osd_handler.c b/lustre/osd-zfs/osd_handler.c index fe9ebc7..94dec9d 100644 --- a/lustre/osd-zfs/osd_handler.c +++ b/lustre/osd-zfs/osd_handler.c @@ -699,15 +699,6 @@ static int osd_ro(const struct lu_env *env, struct dt_device *d) RETURN(0); } -static void osd_wait_quota_pending(struct dt_device *d) -{ - struct osd_device *o = osd_dt_dev(d); - - if (o->od_quota_slave_md != NULL || - o->od_quota_slave_dt != NULL) - txg_wait_callbacks(spa_get_dsl(dmu_objset_spa(o->od_os))); -} - static struct dt_device_operations osd_dt_ops = { .dt_root_get = osd_root_get, .dt_statfs = osd_statfs, @@ -719,7 +710,6 @@ static struct dt_device_operations osd_dt_ops = { .dt_sync = osd_sync, .dt_commit_async = osd_commit_async, .dt_ro = osd_ro, - .dt_wait_quota_pending = osd_wait_quota_pending, }; /* diff --git a/lustre/quota/qsd_handler.c b/lustre/quota/qsd_handler.c index ae770f5..c29b303 100644 --- a/lustre/quota/qsd_handler.c +++ b/lustre/quota/qsd_handler.c @@ -662,7 +662,7 @@ again: */ if (lqe->lqe_pending_write >= space && !wait_pending) { wait_pending = 1; - dt_wait_quota_pending(qqi->qqi_qsd->qsd_dev); + dt_sync(env, qqi->qqi_qsd->qsd_dev); goto again; } -- 1.8.3.1