From: John Hammond Date: Wed, 21 Sep 2011 22:17:25 +0000 (-0500) Subject: LU-334 llite: Add LPROC_LL_OSC_{READ,WRITE}. X-Git-Tag: 2.1.52~36 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=07c6f609d37878ce0d308a129a0f3ae967d6197b LU-334 llite: Add LPROC_LL_OSC_{READ,WRITE}. This patch adds quick and easy access to aggregate OSC BRW (bytes on the wire) statistics through llite. To accomplish this, we pass the number of bytes transferred by a successful request to cl_req_completion(), and on to ll_stats_ops_tally() by way of the ccc_req_completion(). Signed-off-by: John L. Hammond Change-Id: I4b464c27f6dc87fcc19d35b2bc45dc7cb9bf7741 Reviewed-on: http://review.whamcloud.com/1341 Reviewed-by: Richard Henwood Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/linux/lustre_lite.h b/lustre/include/linux/lustre_lite.h index 7d3869d..6087969 100644 --- a/lustre/include/linux/lustre_lite.h +++ b/lustre/include/linux/lustre_lite.h @@ -99,6 +99,8 @@ enum { LPROC_LL_WRITE_BYTES, LPROC_LL_BRW_READ, LPROC_LL_BRW_WRITE, + LPROC_LL_OSC_READ, + LPROC_LL_OSC_WRITE, LPROC_LL_IOCTL, LPROC_LL_OPEN, LPROC_LL_RELEASE, diff --git a/lustre/lclient/lcommon_cl.c b/lustre/lclient/lcommon_cl.c index f1fe4dd..e52fcd4 100644 --- a/lustre/lclient/lcommon_cl.c +++ b/lustre/lclient/lcommon_cl.c @@ -949,6 +949,9 @@ void ccc_req_completion(const struct lu_env *env, { struct ccc_req *vrq; + if (ioret > 0) + cl_stats_tally(slice->crs_dev, slice->crs_req->crq_type, ioret); + vrq = cl2ccc_req(slice); OBD_SLAB_FREE_PTR(vrq, ccc_req_kmem); } diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index efc130b..ea15572 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -428,4 +428,9 @@ static inline struct obd_capa *cl_capa_lookup(struct inode *inode, return NULL; } +static inline void cl_stats_tally(struct cl_device *dev, enum cl_req_type crt, + int rc) +{ +} + #endif diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 9ed1bc9..b488b2e 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -1326,6 +1326,15 @@ struct ll_dio_pages { int ldp_nr; }; +static inline void cl_stats_tally(struct cl_device *dev, enum cl_req_type crt, + int rc) +{ + int opc = (crt == CIT_READ) ? LPROC_LL_OSC_READ : + LPROC_LL_OSC_WRITE; + + ll_stats_ops_tally(ll_s2sbi(cl2ccc_dev(dev)->cdv_sb), opc, rc); +} + extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, int rw, struct inode *inode, struct ll_dio_pages *pv); diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 73e60d8..0845ba7 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -661,6 +661,10 @@ struct llite_file_opcode { "brw_read" }, { LPROC_LL_BRW_WRITE, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_PAGES, "brw_write" }, + { LPROC_LL_OSC_READ, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_BYTES, + "osc_read" }, + { LPROC_LL_OSC_WRITE, LPROCFS_CNTR_AVGMINMAX|LPROCFS_TYPE_BYTES, + "osc_write" }, { LPROC_LL_IOCTL, LPROCFS_TYPE_REGS, "ioctl" }, { LPROC_LL_OPEN, LPROCFS_TYPE_REGS, "open" }, diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 2f876d4..b9499b0 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2276,7 +2276,8 @@ static int brw_interpret(const struct lu_env *env, osc_check_rpcs(env, cli); client_obd_list_unlock(&cli->cl_loi_list_lock); if (!async) - cl_req_completion(env, aa->aa_clerq, rc); + cl_req_completion(env, aa->aa_clerq, rc < 0 ? rc : + req->rq_bulk->bd_nob_transferred); osc_release_ppga(aa->aa_ppga, aa->aa_page_count); RETURN(rc);