Whamcloud - gitweb
LU-12321 mdc: allow ELC for DOM file unlink 42/36442/10
authorMikhail Pershin <mpershin@whamcloud.com>
Fri, 27 Sep 2019 18:29:00 +0000 (21:29 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 14 Feb 2020 05:49:24 +0000 (05:49 +0000)
ELC is skipping DOM bit to prevent data flush when it
is not really needed. Meanwhile if lock bits are combined
that caused unlink slowdown because ELC is disabled for
whole lock if DOM bit exists.

This patch is simple approach which determines if inode has
dirty pages and allows ELC for DOM unlink if there are none.

Test result of mdtest_easy_delete on DoM that unlink for
zero-byte files demostrated 28% perforamnce improvements.

1 x AI400(4 x MDS/MDT) on 10 node challenges:
Without patch:
mdtest_easy_delete  96.564 kiops : time 649.36 seconds
With patch:
mdtest_easy_delete 123.630 kiops : time 454.82 seconds

Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: Ic5b2aed8c8c0884ee518a587a0c45ad54915f4fa
Reviewed-on: https://review.whamcloud.com/36442
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
lustre/include/obd.h
lustre/llite/namei.c
lustre/mdc/mdc_reint.c

index 4bb7f24..78f9217 100644 (file)
@@ -824,6 +824,7 @@ enum md_cli_flags {
        CLI_HASH64      = 1 << 2,
        CLI_API32       = 1 << 3,
        CLI_MIGRATE     = 1 << 4,
        CLI_HASH64      = 1 << 2,
        CLI_API32       = 1 << 3,
        CLI_MIGRATE     = 1 << 4,
+       CLI_DIRTY_DATA  = 1 << 5,
 };
 
 enum md_op_code {
 };
 
 enum md_op_code {
index 31c8d28..edcaade 100644 (file)
@@ -1778,7 +1778,11 @@ static int ll_unlink(struct inode *dir, struct dentry *dchild)
                RETURN(PTR_ERR(op_data));
 
        op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
                RETURN(PTR_ERR(op_data));
 
        op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
-
+       /* notify lower layer if inode has dirty pages */
+       if (S_ISREG(dchild->d_inode->i_mode) &&
+           ll_i2info(dchild->d_inode)->lli_clob &&
+           dirty_cnt(dchild->d_inode))
+               op_data->op_cli_flags |= CLI_DIRTY_DATA;
        op_data->op_fid2 = op_data->op_fid3;
        rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
        ll_finish_md_op_data(op_data);
        op_data->op_fid2 = op_data->op_fid3;
        rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
        ll_finish_md_op_data(op_data);
index b733474..f32d2fb 100644 (file)
@@ -294,10 +294,13 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
                                                MDS_INODELOCK_UPDATE);
        if ((op_data->op_flags & MF_MDC_CANCEL_FID3) &&
            (fid_is_sane(&op_data->op_fid3)))
                                                MDS_INODELOCK_UPDATE);
        if ((op_data->op_flags & MF_MDC_CANCEL_FID3) &&
            (fid_is_sane(&op_data->op_fid3)))
-               /* don't cancel DoM lock which may cause data flush */
+               /* cancel DOM lock only if it has no data to flush */
                count += mdc_resource_get_unused(exp, &op_data->op_fid3,
                                                 &cancels, LCK_EX,
                count += mdc_resource_get_unused(exp, &op_data->op_fid3,
                                                 &cancels, LCK_EX,
-                                                MDS_INODELOCK_ELC);
+                                                op_data->op_cli_flags &
+                                                CLI_DIRTY_DATA ?
+                                                MDS_INODELOCK_ELC :
+                                                MDS_INODELOCK_FULL);
         req = ptlrpc_request_alloc(class_exp2cliimp(exp),
                                    &RQF_MDS_REINT_UNLINK);
         if (req == NULL) {
         req = ptlrpc_request_alloc(class_exp2cliimp(exp),
                                    &RQF_MDS_REINT_UNLINK);
         if (req == NULL) {