From: Patrick Farrell Date: Thu, 27 Jan 2022 21:42:23 +0000 (-0500) Subject: LU-12585 mdt: Add read/write latency to MDT stats X-Git-Tag: 2.15.0-RC1~3 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F29%2F46229%2F4;p=fs%2Flustre-release.git LU-12585 mdt: Add read/write latency to MDT stats 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 Change-Id: I7b7a5742678cbe0269086f37877833e877a5ca5f Reviewed-on: https://review.whamcloud.com/46229 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: Aurelien Degremont Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 5c8df08..0dbde34 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -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, diff --git a/lustre/mdt/mdt_io.c b/lustre/mdt/mdt_io.c index 4989d1d..b4178382 100644 --- a/lustre/mdt/mdt_io.c +++ b/lustre/mdt/mdt_io.c @@ -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) diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index 8dc4597..e3bfce8 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -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");