Whamcloud - gitweb
LU-11114 llite: Update mdc and lite stats on open|creat 48/36948/7
authorOlaf Faaland <faaland1@llnl.gov>
Tue, 26 Nov 2019 23:20:11 +0000 (15:20 -0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 1 Feb 2020 08:10:33 +0000 (08:10 +0000)
Increment "create" counter in mdc/<instance>/md_stats, and
"mknod" counter in llite/<instance>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.

Change-Id: Ib32d828dac35924b929f44f161cff13c99810540
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Reviewed-on: https://review.whamcloud.com/36948
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/namei.c
lustre/mdc/mdc_locks.c

index 43265ab..31c8d28 100644 (file)
@@ -613,7 +613,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,
 static int ll_lookup_it_finish(struct ptlrpc_request *request,
                               struct lookup_intent *it,
                               struct inode *parent, struct dentry **de,
-                              void *secctx, __u32 secctxlen)
+                              void *secctx, __u32 secctxlen,
+                              ktime_t kstart)
 {
        struct inode             *inode = NULL;
        __u64                     bits = 0;
 {
        struct inode             *inode = NULL;
        __u64                     bits = 0;
@@ -718,6 +719,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:
        GOTO(out, rc = 0);
 
 out:
@@ -734,6 +740,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
                                   void **secctx, __u32 *secctxlen,
                                   struct pcc_create_attach *pca)
 {
                                   void **secctx, __u32 *secctxlen,
                                   struct pcc_create_attach *pca)
 {
+       ktime_t kstart = ktime_get();
        struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
        struct dentry *save = dentry, *retval;
        struct ptlrpc_request *req = NULL;
        struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
        struct dentry *save = dentry, *retval;
        struct ptlrpc_request *req = NULL;
@@ -880,7 +887,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
        ll_unlock_md_op_lsm(op_data);
        rc = ll_lookup_it_finish(req, it, parent, &dentry,
                                 secctx != NULL ? *secctx : NULL,
        ll_unlock_md_op_lsm(op_data);
        rc = ll_lookup_it_finish(req, it, parent, &dentry,
                                 secctx != NULL ? *secctx : NULL,
-                                secctxlen != NULL ? *secctxlen : 0);
+                                secctxlen != NULL ? *secctxlen : 0,
+                               kstart);
         if (rc != 0) {
                 ll_intent_release(it);
                 GOTO(out, retval = ERR_PTR(rc));
         if (rc != 0) {
                 ll_intent_release(it);
                 GOTO(out, retval = ERR_PTR(rc));
index 7bceb53..81bfebc 100644 (file)
@@ -743,6 +743,12 @@ static int mdc_finish_enqueue(struct obd_export *exp,
                        mdc_set_open_replay_data(NULL, NULL, it);
                }
 
                        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;
 
                if (body->mbo_valid & (OBD_MD_FLDIREA | OBD_MD_FLEASIZE)) {
                         void *eadata;