Whamcloud - gitweb
LU-334 llite: Add LPROC_LL_OSC_{READ,WRITE}.
authorJohn Hammond <jhammond@tacc.utexas.edu>
Wed, 21 Sep 2011 22:17:25 +0000 (17:17 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 27 Oct 2011 15:09:59 +0000 (11:09 -0400)
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 <jhammond@tacc.utexas.edu>
Change-Id: I4b464c27f6dc87fcc19d35b2bc45dc7cb9bf7741
Reviewed-on: http://review.whamcloud.com/1341
Reviewed-by: Richard Henwood <rhenwood@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jinshan Xiong <jay@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/linux/lustre_lite.h
lustre/lclient/lcommon_cl.c
lustre/liblustre/llite_lib.h
lustre/llite/llite_internal.h
lustre/llite/lproc_llite.c
lustre/osc/osc_request.c

index 7d3869d..6087969 100644 (file)
@@ -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,
index f1fe4dd..e52fcd4 100644 (file)
@@ -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);
 }
index efc130b..ea15572 100644 (file)
@@ -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
index 9ed1bc9..b488b2e 100644 (file)
@@ -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);
index 73e60d8..0845ba7 100644 (file)
@@ -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" },
index 2f876d4..b9499b0 100644 (file)
@@ -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);