From 1ada2c947b894f97ac4e7e9c6435a8b4e42ca1fa Mon Sep 17 00:00:00 2001 From: Hongchao Zhang Date: Sat, 13 Oct 2018 22:37:21 -0400 Subject: [PATCH] LU-11390 quota: mark over-quota flag correctly Currently, if the current granted quota space is less than or equal to the usage + pending_write + waiting_write, the over-quota flag will be marked and sent back to OSC, it will damage the write performance drastically. this patch will compare the current pending and the waiting space to the threshold of over-quota check, and the threshold will be taken into account only if the remain margin quota space is larger than the threshold. Test-Parameters: mdtfilesystemtype=zfs ostfilesystemtype=zfs \ testlist=sanity-quota,sanity-quota,sanity-quota,sanity-quota,sanity-quota Change-Id: I0ecd134c3119ec1d86dbaa6e668091a68b7f5f54 Signed-off-by: Hongchao Zhang Reviewed-on: https://review.whamcloud.com/33238 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Wang Shilong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/quota/qsd_handler.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lustre/quota/qsd_handler.c b/lustre/quota/qsd_handler.c index eb0bddb..577e3cf 100644 --- a/lustre/quota/qsd_handler.c +++ b/lustre/quota/qsd_handler.c @@ -784,10 +784,13 @@ out_flags: __u64 usage; lqe_read_lock(lqe); - usage = lqe->lqe_usage; - usage += lqe->lqe_pending_write; + usage = lqe->lqe_pending_write; usage += lqe->lqe_waiting_write; - usage += qqi->qqi_qsd->qsd_sync_threshold; + if (lqe->lqe_qunit != 0 && (usage % lqe->lqe_qunit > + qqi->qqi_qsd->qsd_sync_threshold)) + usage += qqi->qqi_qsd->qsd_sync_threshold; + + usage += lqe->lqe_usage; qtype_flag = lquota_over_fl(qqi->qqi_qtype); /* if we should notify client to start sync write */ -- 1.8.3.1