Whamcloud - gitweb
LU-12585 mdt: Add read/write latency to MDT stats 29/46229/4
authorPatrick Farrell <pfarrell@whamcloud.com>
Thu, 27 Jan 2022 21:42:23 +0000 (16:42 -0500)
committerOleg Drokin <green@whamcloud.com>
Mon, 7 Feb 2022 04:44:14 +0000 (04:44 +0000)
The MDT does not currently record latency stats for reads
and writes.

Add this, and change the naming to be the same as for the
OFD.

Note on this:
Existing naming on the MDT uses "read/write" instead of
"{read,write}_bytes", which is inconsistent with OFD and
also inconsistent within the MDT, since other ops without
the "_bytes" suffix are latency.

It's not ideal to change the names of existing stats, but I
decided this was less problematic than leaving them
inconsistent.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I7b7a5742678cbe0269086f37877833e877a5ca5f
Reviewed-on: https://review.whamcloud.com/46229
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Aurelien Degremont <degremoa@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_io.c
lustre/mdt/mdt_lproc.c

index 5c8df08..0dbde34 100644 (file)
@@ -1301,6 +1301,8 @@ enum mdt_stat_idx {
        LPROC_MDT_CROSSDIR_RENAME,
        LPROC_MDT_IO_READ,
        LPROC_MDT_IO_WRITE,
+       LPROC_MDT_IO_READ_BYTES,
+       LPROC_MDT_IO_WRITE_BYTES,
        LPROC_MDT_IO_PUNCH,
        LPROC_MDT_MIGRATE,
        LPROC_MDT_FALLOCATE,
index 4989d1d..b417838 100644 (file)
@@ -800,7 +800,9 @@ int mdt_obd_commitrw(const struct lu_env *env, int cmd, struct obd_export *exp,
 
                la_from_obdo(la, oa, valid);
 
-               mdt_counter_incr(req, LPROC_MDT_IO_WRITE, nob);
+               mdt_counter_incr(req, LPROC_MDT_IO_WRITE_BYTES, nob);
+               mdt_counter_incr(req, LPROC_MDT_IO_WRITE,
+                                ktime_us_delta(ktime_get(), kstart));
 
                rc = mdt_commitrw_write(env, exp, mdt, mo, la, oa, objcount,
                                        npages, lnb, oa->o_grant_used, old_rc);
@@ -855,7 +857,9 @@ int mdt_obd_commitrw(const struct lu_env *env, int cmd, struct obd_export *exp,
                if (oa)
                        mdt_dom_obj_lvb_update(env, mo, NULL, true);
 
-               mdt_counter_incr(req, LPROC_MDT_IO_READ, nob);
+               mdt_counter_incr(req, LPROC_MDT_IO_READ_BYTES, nob);
+               mdt_counter_incr(req, LPROC_MDT_IO_READ,
+                                ktime_us_delta(ktime_get(), kstart));
 
                rc = mdt_commitrw_read(env, mdt, mo, objcount, npages, lnb);
                if (old_rc)
index 8dc4597..e3bfce8 100644 (file)
@@ -1524,8 +1524,10 @@ static const char * const mdt_stats[] = {
        [LPROC_MDT_SYNC]                = "sync",
        [LPROC_MDT_SAMEDIR_RENAME]      = "samedir_rename",
        [LPROC_MDT_CROSSDIR_RENAME]     = "crossdir_rename",
-       [LPROC_MDT_IO_READ]             = "read_bytes",
-       [LPROC_MDT_IO_WRITE]            = "write_bytes",
+       [LPROC_MDT_IO_READ_BYTES]       = "read_bytes",
+       [LPROC_MDT_IO_WRITE_BYTES]      = "write_bytes",
+       [LPROC_MDT_IO_READ]             = "read",
+       [LPROC_MDT_IO_WRITE]            = "write",
        [LPROC_MDT_IO_PUNCH]            = "punch",
        [LPROC_MDT_MIGRATE]             = "migrate",
        [LPROC_MDT_FALLOCATE]           = "fallocate",
@@ -1541,7 +1543,8 @@ void mdt_stats_counter_init(struct lprocfs_stats *stats, unsigned int offset)
 
        for (midx = 0; midx < array_size; midx++) {
                oidx = midx + offset;
-               if (midx == LPROC_MDT_IO_READ || midx == LPROC_MDT_IO_WRITE)
+               if (midx == LPROC_MDT_IO_READ_BYTES ||
+                   midx == LPROC_MDT_IO_WRITE_BYTES)
                        lprocfs_counter_init(stats, oidx,
                                             LPROCFS_TYPE_BYTES_FULL,
                                             mdt_stats[midx], "bytes");