From cccd5c79c6697906c8409e867984f73d0ae8474d Mon Sep 17 00:00:00 2001 From: Olaf Faaland Date: Tue, 26 Nov 2019 15:20:11 -0800 Subject: [PATCH] LU-11114 llite: Update mdc and lite stats on open|creat Increment "create" counter in mdc//md_stats, and "mknod" counter in llite/stats when an open with the CREAT flag results in a newly created file. The mknod counter is chosen for consistency with patch http://review.whamcloud.com/20246 "LU-8150 mdt: Track open+create as mknod" but the mdc counter set does not include mknod. Lustre-change: https://review.whamcloud.com/36948 Lustre-commit: 4b8518ee4fa542f45fcdaeaec580d858dfcaf137 Signed-off-by: Olaf Faaland Change-Id: If082b911e415c0bc46248728e47ce0f37b9efa83 Reviewed-on: https://review.whamcloud.com/38158 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Emoly Liu --- lustre/llite/namei.c | 11 +++++++++-- lustre/mdc/mdc_locks.c | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 3cfc768..443eac8 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -617,7 +617,8 @@ struct dentry *ll_splice_alias(struct inode *inode, struct dentry *de) static int ll_lookup_it_finish(struct ptlrpc_request *request, struct lookup_intent *it, - struct inode *parent, struct dentry **de) + struct inode *parent, struct dentry **de, + ktime_t kstart) { struct inode *inode = NULL; __u64 bits = 0; @@ -691,6 +692,11 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, } } + if (it_disposition(it, DISP_OPEN_CREATE)) { + ll_stats_ops_tally(ll_i2sbi(parent), LPROC_LL_MKNOD, + ktime_us_delta(ktime_get(), kstart)); + } + GOTO(out, rc = 0); out: @@ -704,6 +710,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, struct lookup_intent *it, void **secctx, __u32 *secctxlen) { + ktime_t kstart = ktime_get(); struct lookup_intent lookup_it = { .it_op = IT_LOOKUP }; struct dentry *save = dentry, *retval; struct ptlrpc_request *req = NULL; @@ -797,7 +804,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, /* dir layout may change */ ll_unlock_md_op_lsm(op_data); - rc = ll_lookup_it_finish(req, it, parent, &dentry); + rc = ll_lookup_it_finish(req, it, parent, &dentry, kstart); if (rc != 0) { ll_intent_release(it); GOTO(out, retval = ERR_PTR(rc)); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index ccc0337..3269664 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -668,6 +668,12 @@ static int mdc_finish_enqueue(struct obd_export *exp, mdc_set_open_replay_data(NULL, NULL, it); } + if (it_disposition(it, DISP_OPEN_CREATE) && + !it_open_error(DISP_OPEN_CREATE, it)) { + lprocfs_counter_incr(exp->exp_obd->obd_md_stats, + LPROC_MD_CREATE); + } + if (body->mbo_valid & (OBD_MD_FLDIREA | OBD_MD_FLEASIZE)) { void *eadata; -- 1.8.3.1