From e07d4a58206756252c28b51048057c87a7cdb3c6 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Fri, 27 Sep 2019 21:29:00 +0300 Subject: [PATCH] LU-12321 mdc: allow ELC for DOM file unlink 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 Change-Id: Ic5b2aed8c8c0884ee518a587a0c45ad54915f4fa Reviewed-on: https://review.whamcloud.com/36442 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam --- lustre/include/obd.h | 1 + lustre/llite/namei.c | 6 +++++- lustre/mdc/mdc_reint.c | 7 +++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 4bb7f24..78f9217 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -824,6 +824,7 @@ enum md_cli_flags { CLI_HASH64 = 1 << 2, CLI_API32 = 1 << 3, CLI_MIGRATE = 1 << 4, + CLI_DIRTY_DATA = 1 << 5, }; enum md_op_code { diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 31c8d28..edcaade 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -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); - + /* 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); diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index b733474..f32d2fb 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -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))) - /* 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, - 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) { -- 1.8.3.1