diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 4e8074d42c7acb470540b4b6ebe7624bd3e4b6f1..c1358d435364e321e73b137ad01f6b055c125ea7 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -38,8 +38,12 @@ tbd Sun Microsystems, Inc.
 	* Output of lfs quota has been made less detailed by default,
 	  old (verbose) output can be obtained by using -v option.
 
+Severity   : enhancement
+Bugzilla   : 16573
+Description: Export bytes_read/bytes_write count on OSC/OST.
+
 Severity   : normal
-Bugzila    : 16237
+Bugzilla   : 16237
 Description: Early reply size mismatch, MGC loses connection
 Details    : Apply the MGS_CONNECT_SUPPORTED mask at reconnect time so
              the connect flags are properly negotiated.
@@ -88,7 +92,7 @@ Details    : Apply the MGS_CONNECT_SUPPORTED mask at reconnect time so
 
 Severity   : normal
 Bugzilla   : 16006
-Description: Properly propagate oinfo flags from lov to osc for statfs   
+Description: Properly propagate oinfo flags from lov to osc for statfs
 Details    : restore missing copy oi_flags to lov requests.
 
 Severity   : enhancement
@@ -112,7 +116,7 @@ Description: Update to RHEL4 kernel-2.6.9-67.0.22.EL.
 
 Severity   : enhancement
 Bugzilla   : 16091
-Description: configure's --enable-quota should check the 
+Description: configure's --enable-quota should check the
            : kernel .config for CONFIG_QUOTA
 Details    : configure is terminated if --enable-quota is passed but
            : no quota support is in kernel
@@ -126,7 +130,7 @@ Severity   : normal
 Bugzilla   : 16080
 Description: don't fail open with -ERANGE
 Details    : if client connected until mds will be know about real ost count
-             get LOV EA can be fail because mds not allocate enougth buffer 
+             get LOV EA can be fail because mds not allocate enougth buffer
              for LOV EA.
 
 Severity   : normal
@@ -183,7 +187,7 @@ Severity   : normal
 Bugzilla   : 15825
 Description: Kernel BUG tries to release flock
 Details    : Lustre does not destroy flock lock before last reference goes
-	     away. So always drop flock locks when client is evicted and 
+	     away. So always drop flock locks when client is evicted and
 	     perform unlock regardless of successfulness of speaking to MDS.
 
 Severity   : enhancement
@@ -415,7 +419,7 @@ Details    : The direct IO path doesn't call check_rpcs to submit a new RPC once
 
 Severity   : normal
 Bugzilla   : 15684
-Description: Procfs and llog threads access destoryed import sometimes. 
+Description: Procfs and llog threads access destoryed import sometimes.
 Details    : Sync the import destoryed process with procfs and llog threads by
 	     the import refcount and semaphore.
 
@@ -586,20 +590,20 @@ Details	   : Mountpoint references were being leaked during open reply
 Severity   : minor
 Frequency  : rare
 Bugzilla   : 13380
-Description: fix for occasional failure case of -ENOSPC in recovery-small tests 
-Details    : Move the 'good_osts' check before the 'total_bavail' check.  This 
-	     will result in an -EAGAIN and in the exit call path we call 
-	     alloc_rr() which will with increasing aggressiveness attempt to 
+Description: fix for occasional failure case of -ENOSPC in recovery-small tests
+Details    : Move the 'good_osts' check before the 'total_bavail' check.  This
+	     will result in an -EAGAIN and in the exit call path we call
+	     alloc_rr() which will with increasing aggressiveness attempt to
 	     aquire precreated objects on the minimum number of required OSCs.
 
 Severity   : major
 Bugzilla   : 14326
 Description: Use old size assignment to avoid deadlock
 Details    : This reverts the changes in bugs 2369 and bug 14138 that introduced
-	     the scheduling while holding a spinlock.  We do not need locking 
-	     for size in ll_update_inode() because size is only updated from 
-	     the MDS for directories or files without objects, so there is no 
-	     other place to do the update, and concurrent access to such inodes 
+	     the scheduling while holding a spinlock.  We do not need locking
+	     for size in ll_update_inode() because size is only updated from
+	     the MDS for directories or files without objects, so there is no
+	     other place to do the update, and concurrent access to such inodes
 	     are protected by the inode lock.
 
 Severity   : normal
@@ -619,8 +623,8 @@ Severity   : normal
 Bugzilla   : 14872
 Description: the recovery timer never expires
 Details    : for new client connect request, the recovery timer should not be
-	     reset, otherwise recovery timer will never expired, if the old 
-	     client never come. Only old client connect and first connection 
+	     reset, otherwise recovery timer will never expired, if the old
+	     client never come. Only old client connect and first connection
 	     req should trigger recovery timer reset.
 
 Severity   : normal
@@ -732,9 +736,9 @@ Description: Disable adaptive timeouts by default
 Severity   : major
 Frequency  : on network error
 Bugzilla   : 15027
-Description: panic with double free request if network error 
+Description: panic with double free request if network error
 Details    : mdc_finish_enqueue is finish request if any network error occuring,
-	     but it's true only for synchronus enqueue, for async enqueue 
+	     but it's true only for synchronus enqueue, for async enqueue
 	     (via ptlrpcd) this incorrect and ptlrpcd want finish request
 	     himself.
 
@@ -801,14 +805,14 @@ Severity   : normal
 Frequency  : rare
 Bugzilla   : 14421
 Description: ASSERTION(!PageDirty(page)) failed
-Details    : Wrong check could lead to an assertion failure under specific 
+Details    : Wrong check could lead to an assertion failure under specific
 	     load patterns.
 
 Severity   : normal
 Frequency  : rare
 Bugzilla   : 12228
 Description: LBUG in ptlrpc_check_set() bad phase ebc0de00
-Details    : access to bitfield in structure is always rounded to long 
+Details    : access to bitfield in structure is always rounded to long
 	     and this produce problem with not atomic change any bit.
 
 Severity   : normal
@@ -1160,9 +1164,9 @@ Details    : Client gets evicted from server.  Now client also thinks it is
 
 Severity   : normal
 Bugzilla   : 14483
-Description: Detect stride IO mode in read-ahead 
+Description: Detect stride IO mode in read-ahead
 Details    : When a client does stride read, read-ahead should detect that and
-	     read-ahead pages according to the detected stride pattern. 
+	     read-ahead pages according to the detected stride pattern.
 
 Severity   : normal
 Bugzilla   : 15033
@@ -1217,8 +1221,8 @@ Details    : Force q->max_phys_segments to MAX_PHYS_SEGMENTS on SLES10 to be
 Severity   : normal
 Bugzilla   : 15198
 Description: LDLM soft lockups - improvement
-Details    : It is be possible to send the lock handle along with each read 
-	     or write request because the client is already doing a lock match 
+Details    : It is be possible to send the lock handle along with each read
+	     or write request because the client is already doing a lock match
 	     itself so there isn't any reason the OST should have to re-do that
 	     search.
 
@@ -1246,10 +1250,10 @@ Description: during mds failovers with quota on, OSTs got into deadlock state
 	     and causing dumpstack.
 Details	   : for every quota slave, at any time, there is only one quota req
 	     is sent to quota master for every uid/gid. Before that quota req
-	     returns, all the thread relative to the same uid/gid will wait. 
+	     returns, all the thread relative to the same uid/gid will wait.
 	     So if the quota req is lost because mds failovers or any other
 	     reasons, this bug will be hit. Now, dqacq_interpret() will handle
-	     quota reqs who time out. 
+	     quota reqs who time out.
 
 Severity   : enhancement
 Frequency  : always
@@ -1288,9 +1292,9 @@ Severity   : normal
 Frequency  : occasional
 Bugzilla   : 13730
 Description: Do not fail import if osc_interpret_create gets -EAGAIN
-Details    : If osc_interpret_create got -EAGAIN it immediately exits and 
-	     wakeup oscc_waitq.  After wakeup oscc_wait_for_objects call 
-	     oscc_has_objects and see OSC has no objests and call 
+Details    : If osc_interpret_create got -EAGAIN it immediately exits and
+	     wakeup oscc_waitq.  After wakeup oscc_wait_for_objects call
+	     oscc_has_objects and see OSC has no objests and call
 	     oscc_internal_create to resend create request.
 
 Severity   : enhancement
@@ -1317,7 +1321,7 @@ Details    : This causes SLES 10 clients to behave as patchless clients
 	     even on a Lustre-patched (server) kernel.
 
 Severity   : enhancement
-Bugzilla   : 2369 
+Bugzilla   : 2369
 Description: use i_size_read and i_size_write in 2.6 port
 Details    : replace inode->i_size access with i_size_read/write()
 
@@ -1341,7 +1345,7 @@ Frequency  : only on ppc
 Bugzilla   : 12234
 Description: /proc/fs/lustre/devices broken on ppc
 Details    : The patch as applied to 1.6.2 doesn't look correct for all arches.
-	     We should make sure the type of 'index' is loff_t and then cast 
+	     We should make sure the type of 'index' is loff_t and then cast
 	     explicitly as needed below. Do not assign an explicitly cast
 	     loff_t to an int.
 
@@ -1408,15 +1412,15 @@ Frequency  : always
 Bugzilla   : 13751
 Description: Kernel patches update for RHEL5 2.6.18-8.1.14.el5.
 Details    : Modify target file & which_patch.
-	     A flaw was found in the IA32 system call emulation provided 
-	     on AMD64 and Intel 64 platforms. An improperly validated 64-bit 
-	     value could be stored in the %RAX register, which could trigger an 
-	     out-of-bounds system call table access. An untrusted local user 
-	     could exploit this flaw to run code in the kernel 
-	     (ie a root privilege escalation). (CVE-2007-4573). 
+	     A flaw was found in the IA32 system call emulation provided
+	     on AMD64 and Intel 64 platforms. An improperly validated 64-bit
+	     value could be stored in the %RAX register, which could trigger an
+	     out-of-bounds system call table access. An untrusted local user
+	     could exploit this flaw to run code in the kernel
+	     (ie a root privilege escalation). (CVE-2007-4573).
 
 Severity   : minor
-Bugzilla   : 13732 
+Bugzilla   : 13732
 Description: change order of libsysio includes
 Details    : '#include sysio.h' should always come before '#include xtio.h'
 
@@ -1431,12 +1435,12 @@ Frequency  : rarely
 Bugzilla   : 13570
 Description: To avoid grant space > avaible space when the disk is almost
 	     full. Without this patch you might see the error "grant XXXX >
-	     available" or some LBUG about grant, when the disk is almost 
+	     available" or some LBUG about grant, when the disk is almost
 	     full.
 Details    : In filter_check_grant, for non_grant cache write, we should
-	     check the left space by  if (*left > ungranted + bytes), instead 
-	     of (*left > ungranted), because only we are sure the left space 
-	     is enough for another "bytes", then the ungrant space should be 
+	     check the left space by  if (*left > ungranted + bytes), instead
+	     of (*left > ungranted), because only we are sure the left space
+	     is enough for another "bytes", then the ungrant space should be
 	     increase. In client, we should update cl_avail_grant only there is
 	     OBD_MD_FLGRANT in the reply.
 
@@ -1599,10 +1603,10 @@ Details    : change the condition to increase offset_idx
 Severity   : enhancement
 Bugzilla   : 2262
 Description: self-adjustable client's lru lists
-Details    : use adaptive algorithm for managing client cached locks lru 
+Details    : use adaptive algorithm for managing client cached locks lru
 	     lists according to current server load, other client's work
-	     pattern, memory activities, etc. Both, server and client 
-	     side namespaces provide number of proc tunables for controlling 
+	     pattern, memory activities, etc. Both, server and client
+	     side namespaces provide number of proc tunables for controlling
 	     things
 
 Severity   : cleanup
@@ -1611,17 +1615,17 @@ Description: rewrite ext2-derived code in llite/dir.c and obdclass/uuid.c
 Details    : rewrite inherited code (uuid parsing code from ext2 utils and
 	     readdir code from ext3) from scratch preserving functionality.
 
-Severity   : normal 
+Severity   : normal
 Bugzilla   : 13436
 Description: Only those disconnect error should be returned by rq_status.
-Details    : In open/enqueue processs, Some errors, which will cause client 
-	     disconnected, should be returned by rq_status, while other 
+Details    : In open/enqueue processs, Some errors, which will cause client
+	     disconnected, should be returned by rq_status, while other
 	     errors should still be returned by intent, then mdc or llite will
 	     detect them.
 
 Severity   : enhancement
 Bugzilla   : 11230
-Description: Tune the kernel for good SCSI performance. 
+Description: Tune the kernel for good SCSI performance.
 Details    : Set the value of /sys/block/{dev}/queue/max_sectors_kb
 	     to the value of /sys/block/{dev}/queue/max_hw_sectors_kb
 	     in mount_lustre.
@@ -1653,7 +1657,7 @@ Severity   : normal
 Bugzilla   : 13304
 Frequency  : Always, for kernels after 2.6.16
 Description: Fix warning idr_remove called for id=.. which is not allocated.
-Details    : Last kernels save old s_dev before kill super and not allow 
+Details    : Last kernels save old s_dev before kill super and not allow
 	     to restore from callback - restore it before call kill_anon_super.
 
 Severity   : normal
diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h
index bfbcfc66fc1d8a5939b7858044c19460a21355dc..34038724e169e7e7c77a81597a71d2da6556cb04 100644
--- a/lustre/include/lprocfs_status.h
+++ b/lustre/include/lprocfs_status.h
@@ -267,6 +267,8 @@ enum {
         MDS_REINT_UNLINK,
         MDS_REINT_RENAME,
         MDS_REINT_OPEN,
+        BRW_READ_BYTES,
+        BRW_WRITE_BYTES,
         EXTRA_LAST_OPC
 };
 
diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h
index 70e59b2b92b8d1fa8f92c264eaf3831115114f54..d848763a95c1fa7cb0cce8c00ea02703fd3e2e85 100644
--- a/lustre/include/lustre_net.h
+++ b/lustre/include/lustre_net.h
@@ -355,11 +355,11 @@ struct ptlrpc_request {
 
         struct ptlrpc_bulk_desc *rq_bulk;       /* client side bulk */
         /* client outgoing req */
-        time_t rq_sent;                         /* when request sent, seconds, 
+        time_t rq_sent;                         /* when request sent, seconds,
                                                  * or time when request should
                                                  * be sent */
         volatile time_t rq_deadline;     /* when request must finish. volatile
-               so that servers' early reply updates to the deadline aren't 
+               so that servers' early reply updates to the deadline aren't
                kept in per-cpu cache */
         int    rq_timeout;               /* service time estimate (secs) */
 
@@ -408,7 +408,6 @@ static inline int lustre_rep_need_swab(struct ptlrpc_request *req)
         return req->rq_rep_swab_mask & (1 << MSG_PTLRPC_HEADER_OFF);
 }
 
-
 static inline const char *
 ptlrpc_rqphase2str(struct ptlrpc_request *req)
 {
@@ -515,7 +514,7 @@ struct ptlrpc_bulk_desc {
 
 struct ptlrpc_thread {
 
-        struct list_head t_link; /* active threads for service, from svc->srv_threads */
+        struct list_head t_link; /* active threads in svc->srv_threads */
 
         void *t_data;            /* thread-private data (preallocated memory) */
         __u32 t_flags;
@@ -559,7 +558,7 @@ struct ptlrpc_service {
 
         __u32            srv_req_portal;
         __u32            srv_rep_portal;
-        
+
         /* AT stuff */
         struct adaptive_timeout srv_at_estimate;/* estimated rpc service time */
         spinlock_t        srv_at_lock;
@@ -606,7 +605,7 @@ struct ptlrpc_service {
         struct list_head         srv_free_rs_list;
         /* waitq to run, when adding stuff to srv_free_rs_list */
         cfs_waitq_t              srv_free_rs_waitq;
-        
+
         /*
          * if non-NULL called during thread creation (ptlrpc_start_thread())
          * to initialize service specific per-thread state.
@@ -756,7 +755,7 @@ struct ptlrpc_service *ptlrpc_init_svc(int nbufs, int bufsize, int max_req_size,
                                        int watchdog_factor,
                                        svc_handler_t, char *name,
                                        cfs_proc_dir_entry_t *proc_entry,
-                                       svcreq_printfn_t, 
+                                       svcreq_printfn_t,
                                        int min_threads, int max_threads,
                                        char *threadname);
 void ptlrpc_stop_all_threads(struct ptlrpc_service *svc);
@@ -768,7 +767,6 @@ int liblustre_check_services (void *arg);
 void ptlrpc_daemonize(char *name);
 int ptlrpc_service_health_check(struct ptlrpc_service *);
 
-
 struct ptlrpc_svc_data {
         char *name;
         struct ptlrpc_service *svc;
@@ -869,7 +867,7 @@ ptlrpc_rs_decref(struct ptlrpc_reply_state *rs)
 /* Should only be called once per req */
 static inline void ptlrpc_req_drop_rs(struct ptlrpc_request *req)
 {
-        if (req->rq_reply_state == NULL) 
+        if (req->rq_reply_state == NULL)
                 return; /* shouldn't occur */
         ptlrpc_rs_decref(req->rq_reply_state);
         req->rq_reply_state = NULL;
@@ -900,7 +898,7 @@ static inline void
 ptlrpc_req_set_repsize(struct ptlrpc_request *req, int count, __u32 *lens)
 {
         int size = lustre_msg_size(req->rq_reqmsg->lm_magic, count, lens);
-        
+
         req->rq_replen = size + lustre_msg_early_size();
         if (req->rq_reqmsg->lm_magic == LUSTRE_MSG_MAGIC_V2)
                 req->rq_reqmsg->lm_repsize = size;
@@ -940,12 +938,11 @@ const char* ll_opcode2str(__u32 opcode);
 #ifdef LPROCFS
 void ptlrpc_lprocfs_register_obd(struct obd_device *obd);
 void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd);
-void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int opc, int bytes);
+void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int bytes);
 #else
 static inline void ptlrpc_lprocfs_register_obd(struct obd_device *obd) {}
 static inline void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd) {}
-static inline void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int opc,
-                                      int bytes) {}
+static inline void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int bytes) {}
 #endif
 
 /* ptlrpc/llog_server.c */
diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
index a27e83a95929b2f5f7cd3c1a680afc1c059c3c84..1555d61f0437bb1a3ab8575e915a4d2348817cea 100644
--- a/lustre/osc/osc_request.c
+++ b/lustre/osc/osc_request.c
@@ -1463,13 +1463,13 @@ static int async_internal(int cmd, struct obd_export *exp, struct obdo *oa,
         if (cmd == OBD_BRW_READ) {
                 lprocfs_oh_tally_log2(&cli->cl_read_page_hist, page_count);
                 lprocfs_oh_tally(&cli->cl_read_rpc_hist, cli->cl_r_in_flight);
-                ptlrpc_lprocfs_brw(request, OST_READ, aa->aa_requested_nob);
         } else {
                 lprocfs_oh_tally_log2(&cli->cl_write_page_hist, page_count);
                 lprocfs_oh_tally(&cli->cl_write_rpc_hist,
                                  cli->cl_w_in_flight);
-                ptlrpc_lprocfs_brw(request, OST_WRITE, aa->aa_requested_nob);
         }
+        ptlrpc_lprocfs_brw(request, aa->aa_requested_nob);
+
         LASSERT(list_empty(&aa->aa_oaps));
 
         if (rc == 0) {
@@ -2249,15 +2249,14 @@ static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi,
                 lprocfs_oh_tally(&cli->cl_read_rpc_hist, cli->cl_r_in_flight);
                 lprocfs_oh_tally_log2(&cli->cl_read_offset_hist,
                                       (starting_offset >> CFS_PAGE_SHIFT) + 1);
-                ptlrpc_lprocfs_brw(req, OST_READ, aa->aa_requested_nob);
         } else {
                 lprocfs_oh_tally_log2(&cli->cl_write_page_hist, page_count);
                 lprocfs_oh_tally(&cli->cl_write_rpc_hist,
                                  cli->cl_w_in_flight);
                 lprocfs_oh_tally_log2(&cli->cl_write_offset_hist,
                                       (starting_offset >> CFS_PAGE_SHIFT) + 1);
-                ptlrpc_lprocfs_brw(req, OST_WRITE, aa->aa_requested_nob);
         }
+        ptlrpc_lprocfs_brw(req, aa->aa_requested_nob);
 
         client_obd_list_lock(&cli->cl_loi_list_lock);
 
@@ -3346,7 +3345,6 @@ static int osc_getstripe(struct lov_stripe_md *lsm, struct lov_user_md *lump)
         RETURN(rc);
 }
 
-
 static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                          void *karg, void *uarg)
 {
@@ -3635,7 +3633,6 @@ static int osc_set_info_async(struct obd_export *exp, obd_count keylen,
         RETURN(0);
 }
 
-
 static struct llog_operations osc_size_repl_logops = {
         lop_cancel: llog_obd_repl_cancel
 };
diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
index 6cb33dc7dea38a21a17dae53bf51a589208427f6..799e12454bb975a78ba99bafa1f149b50b750ca8 100644
--- a/lustre/ost/ost_handler.c
+++ b/lustre/ost/ost_handler.c
@@ -167,7 +167,7 @@ static int ost_statfs(struct ptlrpc_request *req)
 
         osfs = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof(*osfs));
 
-        req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs, 
+        req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs,
                                     cfs_time_current_64() - HZ, 0);
         if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_ENOSPC))
                 osfs->os_bfree = osfs->os_bavail = 64;
@@ -246,7 +246,7 @@ static int ost_punch_lock_get(struct obd_export *exp, struct obdo *oa,
         else
                 policy.l_extent.end = finis | ~CFS_PAGE_MASK;
 
-        RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, &res_id, 
+        RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, &res_id,
                                       LDLM_EXTENT, &policy, LCK_PW, &flags,
                                       ldlm_blocking_ast, ldlm_completion_ast,
                                       ldlm_glimpse_ast, NULL, 0, NULL, lh));
@@ -574,7 +574,7 @@ static int ost_brw_lock_get(int mode, struct obd_export *exp,
         policy.l_extent.end   = (nb[nrbufs - 1].offset +
                                  nb[nrbufs - 1].len - 1) | ~CFS_PAGE_MASK;
 
-        RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, &res_id, 
+        RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, &res_id,
                                       LDLM_EXTENT, &policy, mode, &flags,
                                       ldlm_blocking_ast, ldlm_completion_ast,
                                       ldlm_glimpse_ast, NULL, 0, NULL, lh));
@@ -641,8 +641,6 @@ static int ost_prolong_locks_iter(struct ldlm_lock *lock, void *data)
 static void ost_prolong_locks(struct obd_export *exp, struct obd_ioobj *obj,
                               struct niobuf_remote *nb, struct obdo *oa,
                               ldlm_mode_t mode)
-
-
 {
         struct ldlm_res_id res_id = { .name = { obj->ioo_id } };
         int nrbufs = obj->ioo_bufcnt;
@@ -774,11 +772,11 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
         if (rc != 0)
                 GOTO(out_bulk, rc);
 
-        /* 
+        /*
          * If getting the lock took more time than
          * client was willing to wait, drop it. b=11330
          */
-        if (cfs_time_current_sec() > req->rq_deadline || 
+        if (cfs_time_current_sec() > req->rq_deadline ||
             OBD_FAIL_CHECK(OBD_FAIL_OST_DROP_REQ)) {
                 no_reply = 1;
                 CERROR("Dropping timed-out read from %s because locking"
@@ -858,20 +856,20 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
                 if (rc == 0) {
                         time_t start = cfs_time_current_sec();
                         do {
-                                long timeoutl = req->rq_deadline - 
+                                long timeoutl = req->rq_deadline -
                                         cfs_time_current_sec();
-                                cfs_duration_t timeout = (timeoutl <= 0 || rc) ? 
+                                cfs_duration_t timeout = (timeoutl <= 0 || rc) ?
                                         CFS_TICK : cfs_time_seconds(timeoutl);
-                                lwi = LWI_TIMEOUT_INTERVAL(timeout, 
+                                lwi = LWI_TIMEOUT_INTERVAL(timeout,
                                                            cfs_time_seconds(1),
-                                                           ost_bulk_timeout, 
+                                                           ost_bulk_timeout,
                                                            desc);
-                                rc = l_wait_event(desc->bd_waitq, 
+                                rc = l_wait_event(desc->bd_waitq,
                                                   !ptlrpc_bulk_active(desc) ||
                                                   exp->exp_failed, &lwi);
                                 LASSERT(rc == 0 || rc == -ETIMEDOUT);
                                 /* Wait again if we changed deadline */
-                        } while ((rc == -ETIMEDOUT) && 
+                        } while ((rc == -ETIMEDOUT) &&
                                  (req->rq_deadline > cfs_time_current_sec()));
 
                         if (rc == -ETIMEDOUT) {
@@ -921,6 +919,7 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti)
         LASSERT(rc <= 0);
         if (rc == 0) {
                 req->rq_status = nob;
+                ptlrpc_lprocfs_brw(req, nob);
                 target_committed_to_req(req);
                 ptlrpc_reply(req);
         } else if (!no_reply) {
@@ -959,7 +958,7 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
         int rc, swab, i, j;
         obd_count                client_cksum = 0, server_cksum = 0;
         cksum_type_t             cksum_type = OBD_CKSUM_CRC32;
-        int                      no_reply = 0; 
+        int                      no_reply = 0;
         ENTRY;
 
         if (OBD_FAIL_CHECK(OBD_FAIL_OST_BRW_WRITE_BULK))
@@ -1067,11 +1066,11 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
         if (rc != 0)
                 GOTO(out_bulk, rc);
 
-        /* 
+        /*
          * If getting the lock took more time than
          * client was willing to wait, drop it. b=11330
          */
-        if (cfs_time_current_sec() > req->rq_deadline || 
+        if (cfs_time_current_sec() > req->rq_deadline ||
             OBD_FAIL_CHECK(OBD_FAIL_OST_DROP_REQ)) {
                 no_reply = 1;
                 CERROR("Dropping timed-out write from %s because locking "
@@ -1092,8 +1091,8 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
         }
 
         /* Because we already sync grant info with client when reconnect,
-         * grant info will be cleared for resent req, then fed_grant and 
-         * total_grant will not be modified in following preprw_write*/ 
+         * grant info will be cleared for resent req, then fed_grant and
+         * total_grant will not be modified in following preprw_write*/
         if (lustre_msg_get_flags(req->rq_reqmsg) & (MSG_RESENT | MSG_REPLAY)) {
                 DEBUG_REQ(D_CACHE, req, "clear resent/replay req grant info");
                 body->oa.o_valid &= ~OBD_MD_FLGRANT;
@@ -1120,18 +1119,18 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
         if (rc == 0) {
                 time_t start = cfs_time_current_sec();
                 do {
-                        long timeoutl = req->rq_deadline - 
+                        long timeoutl = req->rq_deadline -
                                 cfs_time_current_sec();
-                        cfs_duration_t timeout = (timeoutl <= 0 || rc) ? 
+                        cfs_duration_t timeout = (timeoutl <= 0 || rc) ?
                                 CFS_TICK : cfs_time_seconds(timeoutl);
                         lwi = LWI_TIMEOUT_INTERVAL(timeout, cfs_time_seconds(1),
                                                    ost_bulk_timeout, desc);
-                        rc = l_wait_event(desc->bd_waitq, 
+                        rc = l_wait_event(desc->bd_waitq,
                                           !ptlrpc_bulk_active(desc) ||
                                           desc->bd_export->exp_failed, &lwi);
                         LASSERT(rc == 0 || rc == -ETIMEDOUT);
                         /* Wait again if we changed deadline */
-                } while ((rc == -ETIMEDOUT) && 
+                } while ((rc == -ETIMEDOUT) &&
                          (req->rq_deadline > cfs_time_current_sec()));
 
                 if (rc == -ETIMEDOUT) {
@@ -1242,21 +1241,25 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti)
         ost_nio_pages_put(req, local_nb, npages);
 
         if (rc == 0) {
+                int nob = 0;
+
                 /* set per-requested niobuf return codes */
                 for (i = j = 0; i < niocount; i++) {
-                        int nob = remote_nb[i].len;
+                        int len = remote_nb[i].len;
 
+                        nob += len;
                         rcs[i] = 0;
                         do {
                                 LASSERT(j < npages);
                                 if (local_nb[j].rc < 0)
                                         rcs[i] = local_nb[j].rc;
-                                nob -= pp_rnb[j].len;
+                                len -= pp_rnb[j].len;
                                 j++;
-                        } while (nob > 0);
-                        LASSERT(nob == 0);
+                        } while (len > 0);
+                        LASSERT(len == 0);
                 }
                 LASSERT(j == npages);
+                ptlrpc_lprocfs_brw(req, nob);
         }
 
  out_lock:
@@ -1383,7 +1386,7 @@ static int ost_handle_quotacheck(struct ptlrpc_request *req)
 
         oqctl = lustre_swab_reqbuf(req, REQ_REC_OFF, sizeof(*oqctl),
                                    lustre_swab_obd_quotactl);
-        if (oqctl == NULL) 
+        if (oqctl == NULL)
                 RETURN(-EPROTO);
 
         rc = lustre_pack_reply(req, 1, NULL, NULL);
@@ -1837,19 +1840,19 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf)
 
         if (oss_num_threads) {
                 /* If oss_num_threads is set, it is the min and the max. */
-                if (oss_num_threads > OSS_THREADS_MAX) 
+                if (oss_num_threads > OSS_THREADS_MAX)
                         oss_num_threads = OSS_THREADS_MAX;
                 if (oss_num_threads < OSS_THREADS_MIN)
                         oss_num_threads = OSS_THREADS_MIN;
                 oss_max_threads = oss_min_threads = oss_num_threads;
         } else {
                 /* Base min threads on memory and cpus */
-                oss_min_threads = num_possible_cpus() * num_physpages >> 
+                oss_min_threads = num_possible_cpus() * num_physpages >>
                         (27 - CFS_PAGE_SHIFT);
                 if (oss_min_threads < OSS_THREADS_MIN)
                         oss_min_threads = OSS_THREADS_MIN;
                 /* Insure a 4x range for dynamic threads */
-                if (oss_min_threads > OSS_THREADS_MAX / 4) 
+                if (oss_min_threads > OSS_THREADS_MAX / 4)
                         oss_min_threads = OSS_THREADS_MAX / 4;
                 oss_max_threads = min(OSS_THREADS_MAX, oss_min_threads * 4);
         }
@@ -1857,7 +1860,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf)
         ost->ost_service =
                 ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE,
                                 OST_MAXREPSIZE, OST_REQUEST_PORTAL,
-                                OSC_REPLY_PORTAL, OSS_SERVICE_WATCHDOG_FACTOR, 
+                                OSC_REPLY_PORTAL, OSS_SERVICE_WATCHDOG_FACTOR,
                                 ost_handle, LUSTRE_OSS_NAME,
                                 obd->obd_proc_entry, target_print_req,
                                 oss_min_threads, oss_max_threads, "ll_ost");
@@ -1875,7 +1878,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf)
                         oss_num_create_threads = OSS_MAX_CREATE_THREADS;
                 if (oss_num_create_threads < OSS_DEF_CREATE_THREADS)
                         oss_num_create_threads = OSS_DEF_CREATE_THREADS;
-                oss_min_create_threads = oss_max_create_threads = 
+                oss_min_create_threads = oss_max_create_threads =
                         oss_num_create_threads;
         } else {
                 oss_min_create_threads = OSS_DEF_CREATE_THREADS;
@@ -1903,7 +1906,7 @@ static int ost_setup(struct obd_device *obd, obd_count len, void *buf)
         ost->ost_io_service =
                 ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE,
                                 OST_MAXREPSIZE, OST_IO_PORTAL,
-                                OSC_REPLY_PORTAL, OSS_SERVICE_WATCHDOG_FACTOR, 
+                                OSC_REPLY_PORTAL, OSS_SERVICE_WATCHDOG_FACTOR,
                                 ost_handle, "ost_io",
                                 obd->obd_proc_entry, target_print_req,
                                 oss_min_threads, oss_max_threads, "ll_ost_io");
@@ -1999,7 +2002,6 @@ static struct obd_ops ost_obd_ops = {
         .o_health_check = ost_health_check,
 };
 
-
 static int __init ost_init(void)
 {
         struct lprocfs_static_vars lvars;
diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c
index 15fb2e2d849e82c84e8b5d2455ebdb3597224904..ca2fee55fd898de98e5dfb64188dcc5643456153 100644
--- a/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/lustre/ptlrpc/lproc_ptlrpc.c
@@ -134,6 +134,8 @@ struct ll_eopcode {
         { MDS_REINT_UNLINK,     "mds_reint_unlink" },
         { MDS_REINT_RENAME,     "mds_reint_rename" },
         { MDS_REINT_OPEN,       "mds_reint_open" },
+        { BRW_READ_BYTES,       "read_bytes" },
+        { BRW_WRITE_BYTES,      "write_bytes" },
 };
 
 const char *ll_opcode2str(__u32 opcode)
@@ -200,9 +202,20 @@ void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
         lprocfs_counter_init(svc_stats, PTLRPC_REQBUF_AVAIL_CNTR,
                              svc_counter_config, "reqbuf_avail", "bufs");
         for (i = 0; i < EXTRA_LAST_OPC; i++) {
+                char *units;
+
+                switch(i) {
+                case BRW_WRITE_BYTES:
+                case BRW_READ_BYTES:
+                        units = "bytes";
+                        break;
+                default:
+                        units = "reqs";
+                        break;
+                }
                 lprocfs_counter_init(svc_stats, PTLRPC_LAST_CNTR + i,
                                      svc_counter_config,
-                                     ll_eopcode2str(i), "reqs");
+                                     ll_eopcode2str(i), units);
         }
         for (i = 0; i < LUSTRE_MAX_OPCODES; i++) {
                 __u32 opcode = ll_rpc_opcode_table[i].opcode;
@@ -424,8 +437,8 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter)
                  * parser. Currently I only print stuff here I know is OK
                  * to look at coz it was set up in request_in_callback()!!! */
                 seq_printf(s, LPD64":%s:%s:x"LPD64":%d:%s:%ld:%lds(%+lds) ",
-                           req->rq_history_seq, libcfs_nid2str(req->rq_self), 
-                           libcfs_id2str(req->rq_peer), req->rq_xid, 
+                           req->rq_history_seq, libcfs_nid2str(req->rq_self),
+                           libcfs_id2str(req->rq_peer), req->rq_xid,
                            req->rq_reqlen, ptlrpc_rqphase2str(req),
                            req->rq_arrival_time.tv_sec,
                            req->rq_sent - req->rq_arrival_time.tv_sec,
@@ -485,14 +498,14 @@ static int ptlrpc_lprocfs_rd_timeouts(char *page, char **start, off_t off,
                 rc += snprintf(page + rc, count - rc,
                               "adaptive timeouts off, using obd_timeout %u\n",
                               obd_timeout);
-        rc += snprintf(page + rc, count - rc, 
+        rc += snprintf(page + rc, count - rc,
                        "%10s : cur %3u  worst %3u (at %ld, "DHMS_FMT" ago) ",
-                       "service", cur, worst, worstt, 
+                       "service", cur, worst, worstt,
                        DHMS_VARS(&ts));
         rc = lprocfs_at_hist_helper(page, count, rc,
                                     &svc->srv_at_estimate);
         return rc;
-}               
+}
 
 void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
                                      struct ptlrpc_service *svc)
@@ -555,27 +568,43 @@ void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req)
         if (svc_stats == NULL || opc <= 0)
                 return;
         LASSERT(opc < LUSTRE_MAX_OPCODES);
-        /* These two use the ptlrpc_lprocfs_brw below */
-        if (!(opc == OST_WRITE || opc == OST_READ || op == LDLM_ENQUEUE
-              || op == MDS_REINT))
+        if (!(op == LDLM_ENQUEUE || op == MDS_REINT))
                 lprocfs_counter_add(svc_stats, opc + EXTRA_MAX_OPCODES, 0);
 }
 
-void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int opc, int bytes)
+void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int bytes)
 {
         struct lprocfs_stats *svc_stats;
+        int idx;
+
+        if (!req->rq_import)
+                return;
         svc_stats = req->rq_import->imp_obd->obd_svc_stats;
-        if (!svc_stats) 
+        if (!svc_stats)
                 return;
-        lprocfs_counter_add(svc_stats, opc + EXTRA_MAX_OPCODES, bytes);
+        idx = lustre_msg_get_opc(req->rq_reqmsg);
+        switch (idx) {
+        case OST_READ:
+                idx = BRW_READ_BYTES + PTLRPC_LAST_CNTR;
+                break;
+        case OST_WRITE:
+                idx = BRW_WRITE_BYTES + PTLRPC_LAST_CNTR;
+                break;
+        default:
+                LASSERTF(0, "unsupported opcode %u\n", idx);
+                break;
+        }
+
+        lprocfs_counter_add(svc_stats, idx, bytes);
 }
+
 EXPORT_SYMBOL(ptlrpc_lprocfs_brw);
 
 void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc)
 {
-        if (svc->srv_procroot != NULL) 
+        if (svc->srv_procroot != NULL)
                 lprocfs_remove(&svc->srv_procroot);
-        if (svc->srv_stats) 
+        if (svc->srv_stats)
                 lprocfs_free_stats(&svc->srv_stats);
 }
 
@@ -595,12 +624,12 @@ int lprocfs_wr_evict_client(struct file *file, const char *buffer,
         struct obd_device *obd = data;
         char tmpbuf[sizeof(struct obd_uuid)];
 
-        /* Kludge code(deadlock situation): the lprocfs lock has been held 
+        /* Kludge code(deadlock situation): the lprocfs lock has been held
          * since the client is evicted by writting client's
-         * uuid/nid to procfs "evict_client" entry. However, 
+         * uuid/nid to procfs "evict_client" entry. However,
          * obd_export_evict_by_uuid() will call lprocfs_remove() to destroy
          * the proc entries under the being destroyed export{}, so I have
-         * to drop the lock at first here. 
+         * to drop the lock at first here.
          * - jay, jxiong@clusterfs.com */
         class_incref(obd);
         LPROCFS_EXIT();
diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index 472129e767a5393f073e8fa13f1d01a46914444c..6fa8aaa12c9d89213d666cdb104f7445d8455cab 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -549,7 +549,7 @@ test_24d() {
 run_test 24d "mkdir .../R4/{f,g}; rename .../R4/f .../R4/g ====="
 
 test_24e() {
-	echo '-- cross directory renames --' 
+	echo '-- cross directory renames --'
 	mkdir $DIR/R5{a,b}
 	touch $DIR/R5a/f
 	mv $DIR/R5a/f $DIR/R5b/g
@@ -604,7 +604,7 @@ test_24j() {
 	$CHECKSTAT -a $DIR/R10/f || error
 	$CHECKSTAT -a $DIR/R10/g || error
 }
-run_test 24j "source does not exist ============================" 
+run_test 24j "source does not exist ============================"
 
 test_24k() {
 	mkdir $DIR/R11a $DIR/R11a/d
@@ -1202,27 +1202,27 @@ run_test 31f "remove of open directory with open-unlink file ==="
 test_32a() {
 	echo "== more mountpoints and symlinks ================="
 	[ -e $DIR/d32a ] && rm -fr $DIR/d32a
-	mkdir -p $DIR/d32a/ext2-mountpoint 
+	mkdir -p $DIR/d32a/ext2-mountpoint
 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32a/ext2-mountpoint || error
-	$CHECKSTAT -t dir $DIR/d32a/ext2-mountpoint/.. || error  
+	$CHECKSTAT -t dir $DIR/d32a/ext2-mountpoint/.. || error
 	$UMOUNT $DIR/d32a/ext2-mountpoint || error
 }
 run_test 32a "stat d32a/ext2-mountpoint/.. ====================="
 
 test_32b() {
 	[ -e $DIR/d32b ] && rm -fr $DIR/d32b
-	mkdir -p $DIR/d32b/ext2-mountpoint 
+	mkdir -p $DIR/d32b/ext2-mountpoint
 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32b/ext2-mountpoint || error
 	ls -al $DIR/d32b/ext2-mountpoint/.. || error
 	$UMOUNT $DIR/d32b/ext2-mountpoint || error
 }
 run_test 32b "open d32b/ext2-mountpoint/.. ====================="
- 
+
 test_32c() {
 	[ -e $DIR/d32c ] && rm -fr $DIR/d32c
-	mkdir -p $DIR/d32c/ext2-mountpoint 
+	mkdir -p $DIR/d32c/ext2-mountpoint
 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32c/ext2-mountpoint || error
-	mkdir -p $DIR/d32c/d2/test_dir    
+	mkdir -p $DIR/d32c/d2/test_dir
 	$CHECKSTAT -t dir $DIR/d32c/ext2-mountpoint/../d2/test_dir || error
 	$UMOUNT $DIR/d32c/ext2-mountpoint || error
 }
@@ -1230,9 +1230,9 @@ run_test 32c "stat d32c/ext2-mountpoint/../d2/test_dir ========="
 
 test_32d() {
 	[ -e $DIR/d32d ] && rm -fr $DIR/d32d
-	mkdir -p $DIR/d32d/ext2-mountpoint 
+	mkdir -p $DIR/d32d/ext2-mountpoint
 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32d/ext2-mountpoint || error
-	mkdir -p $DIR/d32d/d2/test_dir    
+	mkdir -p $DIR/d32d/d2/test_dir
 	ls -al $DIR/d32d/ext2-mountpoint/../d2/test_dir || error
 	$UMOUNT $DIR/d32d/ext2-mountpoint || error
 }
@@ -1240,10 +1240,10 @@ run_test 32d "open d32d/ext2-mountpoint/../d2/test_dir ========="
 
 test_32e() {
 	[ -e $DIR/d32e ] && rm -fr $DIR/d32e
-	mkdir -p $DIR/d32e/tmp    
-	TMP_DIR=$DIR/d32e/tmp       
-	ln -s $DIR/d32e $TMP_DIR/symlink11 
-	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01 
+	mkdir -p $DIR/d32e/tmp
+	TMP_DIR=$DIR/d32e/tmp
+	ln -s $DIR/d32e $TMP_DIR/symlink11
+	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
 	$CHECKSTAT -t link $DIR/d32e/tmp/symlink11 || error
 	$CHECKSTAT -t link $DIR/d32e/symlink01 || error
 }
@@ -1251,20 +1251,20 @@ run_test 32e "stat d32e/symlink->tmp/symlink->lustre-subdir ===="
 
 test_32f() {
 	[ -e $DIR/d32f ] && rm -fr $DIR/d32f
-	mkdir -p $DIR/d32f/tmp    
-	TMP_DIR=$DIR/d32f/tmp       
-	ln -s $DIR/d32f $TMP_DIR/symlink11 
-	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01 
+	mkdir -p $DIR/d32f/tmp
+	TMP_DIR=$DIR/d32f/tmp
+	ln -s $DIR/d32f $TMP_DIR/symlink11
+	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
 	ls $DIR/d32f/tmp/symlink11  || error
 	ls $DIR/d32f/symlink01 || error
 }
 run_test 32f "open d32f/symlink->tmp/symlink->lustre-subdir ===="
 
 test_32g() {
-	TMP_DIR=$DIR/$tdir/tmp       
+	TMP_DIR=$DIR/$tdir/tmp
 	mkdir -p $TMP_DIR $DIR/${tdir}2
-	ln -s $DIR/${tdir}2 $TMP_DIR/symlink12 
-	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 
+	ln -s $DIR/${tdir}2 $TMP_DIR/symlink12
+	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
 	$CHECKSTAT -t link $TMP_DIR/symlink12 || error
 	$CHECKSTAT -t link $DIR/$tdir/symlink02 || error
 	$CHECKSTAT -t dir -f $TMP_DIR/symlink12 || error
@@ -1274,10 +1274,10 @@ run_test 32g "stat d32g/symlink->tmp/symlink->lustre-subdir/${tdir}2"
 
 test_32h() {
 	rm -fr $DIR/$tdir $DIR/${tdir}2
-	TMP_DIR=$DIR/$tdir/tmp       
-	mkdir -p $TMP_DIR $DIR/${tdir}2 
-	ln -s $DIR/${tdir}2 $TMP_DIR/symlink12 
-	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 
+	TMP_DIR=$DIR/$tdir/tmp
+	mkdir -p $TMP_DIR $DIR/${tdir}2
+	ln -s $DIR/${tdir}2 $TMP_DIR/symlink12
+	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
 	ls $TMP_DIR/symlink12 || error
 	ls $DIR/$tdir/symlink02  || error
 }
@@ -1285,17 +1285,17 @@ run_test 32h "open d32h/symlink->tmp/symlink->lustre-subdir/${tdir}2"
 
 test_32i() {
 	[ -e $DIR/d32i ] && rm -fr $DIR/d32i
-	mkdir -p $DIR/d32i/ext2-mountpoint 
+	mkdir -p $DIR/d32i/ext2-mountpoint
 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32i/ext2-mountpoint || error
 	touch $DIR/d32i/test_file
-	$CHECKSTAT -t file $DIR/d32i/ext2-mountpoint/../test_file || error  
+	$CHECKSTAT -t file $DIR/d32i/ext2-mountpoint/../test_file || error
 	$UMOUNT $DIR/d32i/ext2-mountpoint || error
 }
 run_test 32i "stat d32i/ext2-mountpoint/../test_file ==========="
 
 test_32j() {
 	[ -e $DIR/d32j ] && rm -fr $DIR/d32j
-	mkdir -p $DIR/d32j/ext2-mountpoint 
+	mkdir -p $DIR/d32j/ext2-mountpoint
 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32j/ext2-mountpoint || error
 	touch $DIR/d32j/test_file
 	cat $DIR/d32j/ext2-mountpoint/../test_file || error
@@ -1305,8 +1305,8 @@ run_test 32j "open d32j/ext2-mountpoint/../test_file ==========="
 
 test_32k() {
 	rm -fr $DIR/d32k
-	mkdir -p $DIR/d32k/ext2-mountpoint 
-	mount -t ext2 -o loop $EXT2_DEV $DIR/d32k/ext2-mountpoint  
+	mkdir -p $DIR/d32k/ext2-mountpoint
+	mount -t ext2 -o loop $EXT2_DEV $DIR/d32k/ext2-mountpoint
 	mkdir -p $DIR/d32k/d2
 	touch $DIR/d32k/d2/test_file || error
 	$CHECKSTAT -t file $DIR/d32k/ext2-mountpoint/../d2/test_file || error
@@ -1316,7 +1316,7 @@ run_test 32k "stat d32k/ext2-mountpoint/../d2/test_file ========"
 
 test_32l() {
 	rm -fr $DIR/d32l
-	mkdir -p $DIR/d32l/ext2-mountpoint 
+	mkdir -p $DIR/d32l/ext2-mountpoint
 	mount -t ext2 -o loop $EXT2_DEV $DIR/d32l/ext2-mountpoint || error
 	mkdir -p $DIR/d32l/d2
 	touch $DIR/d32l/d2/test_file
@@ -1327,10 +1327,10 @@ run_test 32l "open d32l/ext2-mountpoint/../d2/test_file ========"
 
 test_32m() {
 	rm -fr $DIR/d32m
-	mkdir -p $DIR/d32m/tmp    
-	TMP_DIR=$DIR/d32m/tmp       
-	ln -s $DIR $TMP_DIR/symlink11 
-	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01 
+	mkdir -p $DIR/d32m/tmp
+	TMP_DIR=$DIR/d32m/tmp
+	ln -s $DIR $TMP_DIR/symlink11
+	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
 	$CHECKSTAT -t link $DIR/d32m/tmp/symlink11 || error
 	$CHECKSTAT -t link $DIR/d32m/symlink01 || error
 }
@@ -1338,10 +1338,10 @@ run_test 32m "stat d32m/symlink->tmp/symlink->lustre-root ======"
 
 test_32n() {
 	rm -fr $DIR/d32n
-	mkdir -p $DIR/d32n/tmp    
-	TMP_DIR=$DIR/d32n/tmp       
-	ln -s $DIR $TMP_DIR/symlink11 
-	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01 
+	mkdir -p $DIR/d32n/tmp
+	TMP_DIR=$DIR/d32n/tmp
+	ln -s $DIR $TMP_DIR/symlink11
+	ln -s $TMP_DIR/symlink11 $TMP_DIR/../symlink01
 	ls -l $DIR/d32n/tmp/symlink11  || error
 	ls -l $DIR/d32n/symlink01 || error
 }
@@ -1349,11 +1349,11 @@ run_test 32n "open d32n/symlink->tmp/symlink->lustre-root ======"
 
 test_32o() {
 	rm -fr $DIR/d32o $DIR/$tfile
-	touch $DIR/$tfile 
-	mkdir -p $DIR/d32o/tmp    
-	TMP_DIR=$DIR/d32o/tmp       
-	ln -s $DIR/$tfile $TMP_DIR/symlink12 
-	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 
+	touch $DIR/$tfile
+	mkdir -p $DIR/d32o/tmp
+	TMP_DIR=$DIR/d32o/tmp
+	ln -s $DIR/$tfile $TMP_DIR/symlink12
+	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
 	$CHECKSTAT -t link $DIR/d32o/tmp/symlink12 || error
 	$CHECKSTAT -t link $DIR/d32o/symlink02 || error
 	$CHECKSTAT -t file -f $DIR/d32o/tmp/symlink12 || error
@@ -1367,15 +1367,15 @@ test_32p() {
     log 32p_2
 	rm -f $DIR/$tfile
     log 32p_3
-	touch $DIR/$tfile 
+	touch $DIR/$tfile
     log 32p_4
-	mkdir -p $DIR/d32p/tmp    
+	mkdir -p $DIR/d32p/tmp
     log 32p_5
-	TMP_DIR=$DIR/d32p/tmp       
+	TMP_DIR=$DIR/d32p/tmp
     log 32p_6
-	ln -s $DIR/$tfile $TMP_DIR/symlink12 
+	ln -s $DIR/$tfile $TMP_DIR/symlink12
     log 32p_7
-	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02 
+	ln -s $TMP_DIR/symlink12 $TMP_DIR/../symlink02
     log 32p_8
 	cat $DIR/d32p/tmp/symlink12 || error
     log 32p_9
@@ -1454,7 +1454,7 @@ test_34b() {
 run_test 34b "O_RDONLY opening file doesn't create objects ====="
 
 test_34c() {
-	[ ! -f $DIR/f34 ] && test_34a 
+	[ ! -f $DIR/f34 ] && test_34a
 	$CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
 	$OPENFILE -f O_RDWR $DIR/f34
 	$GETSTRIPE $DIR/f34 2>&1 | grep -q "no stripe info" && error
@@ -1463,7 +1463,7 @@ test_34c() {
 run_test 34c "O_RDWR opening file-with-size works =============="
 
 test_34d() {
-	[ ! -f $DIR/f34 ] && test_34a 
+	[ ! -f $DIR/f34 ] && test_34a
 	dd if=/dev/zero of=$DIR/f34 conv=notrunc bs=4k count=1 || error
 	$CHECKSTAT -s $TEST_34_SIZE $DIR/f34 || error
 	rm $DIR/f34
@@ -1614,7 +1614,7 @@ run_test 39 "mtime changed on create ==========================="
 function get_times() {
         FILE=$1
         TIME=$2
-        
+
         i=0
         for time in `stat -c "%X %Y %Z" $FILE`; do
                 eval "$TIME[$i]=$time"
@@ -1648,7 +1648,7 @@ test_39b() {
         get_times $DIR/$tdir/flink LINK_NEW
         get_times $DIR/$tdir/funlink UNLINK_NEW
         get_times $DIR/$tdir/frename RENAME_NEW
-        
+
         cat $DIR/$tdir/fopen > /dev/null
         ln $DIR/$tdir/flink $DIR/$tdir/flink2
         rm -f $DIR/$tdir/funlink2
@@ -1663,7 +1663,7 @@ test_39b() {
         echo ${UNLINK_OLD[1]},${UNLINK_NEW[$MTIME]},${UNLINK_NEW2[$MTIME]}
         echo ${RENAME_OLD[1]},${RENAME_NEW[$MTIME]},${RENAME_NEW2[$MTIME]}
 
-        
+
         [ ${OPEN_NEW2[$MTIME]} -eq ${OPEN_NEW[$MTIME]} ] || \
                 error "open file reverses mtime"
         [ ${LINK_NEW2[$MTIME]} -eq ${LINK_NEW[$MTIME]} ] || \
@@ -1962,7 +1962,7 @@ page_size() {
 
 # in a 2 stripe file (lov.sh), page 1023 maps to page 511 in its object.  this
 # test tickles a bug where re-dirtying a page was failing to be mapped to the
-# objects offset and an assert hit when an rpc was built with 1023's mapped 
+# objects offset and an assert hit when an rpc was built with 1023's mapped
 # offset 511 and 511's raw 511 offset. it also found general redirtying bugs.
 test_46() {
 	f="$DIR/f46"
@@ -2158,7 +2158,7 @@ test_51d() {
 		error "OST $N has less objects vs OST $NLAST (${OBJS[$N]} < ${OBJS[$NLAST]}"
 	    [ ${OBJS[$N]} -gt $((${OBJS[$NLAST]} + 20)) ] && \
 		error "OST $N has less objects vs OST $NLAST (${OBJS[$N]} < ${OBJS[$NLAST]}"
-	    
+
 	    [ ${OBJS0[$N]} -lt $((${OBJS0[$NLAST]} - 20)) ] && \
 		error "OST $N has less #0 objects vs OST $NLAST (${OBJS0[$N]} < ${OBJS0[$NLAST]}"
 	    [ ${OBJS0[$N]} -gt $((${OBJS0[$NLAST]} + 20)) ] && \
@@ -2251,7 +2251,7 @@ test_54b() {
 	f="$DIR/f54b"
 	mknod $f c 1 3
 	chmod 0666 $f
-	dd if=/dev/zero of=$f bs=`page_size` count=1 
+	dd if=/dev/zero of=$f bs=`page_size` count=1
 }
 run_test 54b "char device works in lustre ======================"
 
@@ -2273,7 +2273,7 @@ test_54c() {
 	tdir="$DIR/d54c"
 	loopdev="$DIR/loop54c"
 
-	find_loop_dev 
+	find_loop_dev
 	[ -z "$LOOPNUM" ] && echo "couldn't find empty loop device" && return
 	mknod $loopdev b 7 $LOOPNUM
 	echo "make a loop file system with $tfile on $loopdev ($LOOPNUM)..."
@@ -2581,7 +2581,7 @@ test_57a() {
 	remote_mds && skip "remote MDS" && return
 	local MNTDEV="mds.*.mntdev"
 	DEV=$(lctl get_param -n $MNTDEV)
-	[ -z "$DEV" ] && error "can't access $MNTDEV" 
+	[ -z "$DEV" ] && error "can't access $MNTDEV"
 	for DEV in `lctl get_param -n $MNTDEV`; do
 		dumpe2fs -h $DEV > $TMP/t57a.dump || error "can't access $DEV"
 		DEVISIZE=`awk '/Inode size:/ { print $3 }' $TMP/t57a.dump`
@@ -2675,7 +2675,7 @@ test_60b() { # bug 6411
 run_test 60b "limit repeated messages from CERROR/CWARN ========"
 
 test_60c() {
-	echo "create 5000 files" 
+	echo "create 5000 files"
 	createmany -o $DIR/f60c- 5000
 	#define OBD_FAIL_MDS_LLOG_CREATE_FAILED  0x137
 	lctl set_param fail_loc=0x80000137
@@ -2843,9 +2843,9 @@ test_65h() {
           "`$GETSTRIPE -v $DIR/d65/dd1 | grep "^count"`" ] || error "stripe info inherit failed"
 }
 run_test 65h "directory stripe info inherit ===================="
- 
+
 test_65i() { # bug6367
-        $SETSTRIPE $MOUNT -s 65536 -c -1 
+        $SETSTRIPE $MOUNT -s 65536 -c -1
 }
 run_test 65i "set non-default striping on root directory (bug 6367)="
 
@@ -3080,7 +3080,7 @@ run_test 72 "Test that remove suid works properly (bug5695) ===="
 
 # bug 3462 - multiple simultaneous MDC requests
 test_73() {
-	mkdir $DIR/d73-1 
+	mkdir $DIR/d73-1
 	mkdir $DIR/d73-2
 	multiop_bg_pause $DIR/d73-1/f73-1 O_c || return 1
 	pid1=$!
@@ -3100,8 +3100,8 @@ test_73() {
 	sleep 25
 
 	$CHECKSTAT -t file $DIR/d73-1/f73-1 || return 4
-	$CHECKSTAT -t file $DIR/d73-1/f73-2 || return 5 
-	$CHECKSTAT -t file $DIR/d73-2/f73-3 || return 6 
+	$CHECKSTAT -t file $DIR/d73-1/f73-2 || return 5
+	$CHECKSTAT -t file $DIR/d73-2/f73-3 || return 6
 
 	rm -rf $DIR/d73-*
 }
@@ -3143,22 +3143,22 @@ export T75_PREP=no
 test75_prep() {
         [ $T75_PREP = "yes" ] && return
         echo "using F75=$F75, F128k=$F128k, FHEAD=$FHEAD, FTAIL=$FTAIL"
- 
+
         dd if=/dev/urandom of=${F75}_128k bs=128k count=1 || error "dd failed"
         log "finished dd"
         chmod 777 ${F128k}
         T75_PREP=yes
 }
- 
+
 test_75a() {
         test75_prep
- 
+
         cp -p ${F128k} ${FHEAD}
         log "finished cp to $FHEAD"
         cp -p ${F128k} ${FTAIL}
         log "finished cp to $FTAIL"
         cat ${F128k} ${F128k} > ${F75}_sim_sim
- 
+
         $JOIN ${FHEAD} ${FTAIL} || error "join ${FHEAD} ${FTAIL} error"
         log "finished join $FHEAD to ${F75}_sim_sim"
         cmp ${FHEAD} ${F75}_sim_sim || error "${FHEAD} ${F75}_sim_sim differ"
@@ -3166,10 +3166,10 @@ test_75a() {
         $CHECKSTAT -a ${FTAIL} || error "tail ${FTAIL} still exist after join"
 }
 run_test 75a "TEST join file ===================================="
- 
+
 test_75b() {
         test75_prep
- 
+
         cp -p ${F128k} ${FTAIL}
         cat ${F75}_sim_sim >> ${F75}_join_sim
         cat ${F128k} >> ${F75}_join_sim
@@ -3179,10 +3179,10 @@ test_75b() {
         $CHECKSTAT -a ${FTAIL} || error "tail ${FTAIL} exist after join"
 }
 run_test 75b "TEST join file 2 =================================="
- 
+
 test_75c() {
         test75_prep
- 
+
         cp -p ${F128k} ${FTAIL}
         cat ${F128k} >> ${F75}_sim_join
         cat ${F75}_join_sim >> ${F75}_sim_join
@@ -3192,10 +3192,10 @@ test_75c() {
         $CHECKSTAT -a ${FHEAD} || error "tail ${FHEAD} exist after join"
 }
 run_test 75c "TEST join file 3 =================================="
- 
+
 test_75d() {
         test75_prep
- 
+
         cp -p ${F128k} ${FHEAD}
         cp -p ${F128k} ${FHEAD}_tmp
         cat ${F75}_sim_sim >> ${F75}_join_join
@@ -3206,17 +3206,17 @@ test_75d() {
         $CHECKSTAT -a ${FTAIL} || error "tail ${FTAIL} exist after join (2)"
 }
 run_test 75d "TEST join file 4 =================================="
- 
+
 test_75e() {
         test75_prep
- 
+
         rm -rf ${FHEAD} || "delete join file error"
 }
 run_test 75e "TEST join file 5 (remove joined file) ============="
- 
+
 test_75f() {
         test75_prep
- 
+
         cp -p ${F128k} ${F75}_join_10_compare
         cp -p ${F128k} ${F75}_join_10
         for ((i = 0; i < 10; i++)); do
@@ -3230,13 +3230,13 @@ test_75f() {
                 error "files ${F75}_join_10 ${F75}_join_10_compare differ"
 }
 run_test 75f "TEST join file 6 (join 10 files) =================="
- 
+
 test_75g() {
         [ ! -f ${F75}_join_10 ] && echo "${F75}_join_10 missing" && return
         $LFS getstripe ${F75}_join_10
- 
+
         $OPENUNLINK ${F75}_join_10 ${F75}_join_10 || error "files unlink open"
- 
+
         ls -l $F75*
 }
 run_test 75g "TEST join file 7 (open unlink) ===================="
@@ -3314,7 +3314,7 @@ test_77b() { # bug 10889
 run_test 77b "checksum error on client write ===================="
 
 test_77c() { # bug 10889
-	[ ! -f $DIR/f77b ] && skip "requires 77b - skipping" && return  
+	[ ! -f $DIR/f77b ] && skip "requires 77b - skipping" && return
 	set_checksums 1
 	for algo in $CKSUM_TYPES; do
 		cancel_lru_locks osc
@@ -3341,7 +3341,7 @@ test_77d() { # bug 10889
 run_test 77d "checksum error on OST direct write ==============="
 
 test_77e() { # bug 10889
-	[ ! -f $DIR/f77 ] && skip "requires 77d - skipping" && return  
+	[ ! -f $DIR/f77 ] && skip "requires 77d - skipping" && return
 	#define OBD_FAIL_OSC_CHECKSUM_RECEIVE    0x408
 	lctl set_param fail_loc=0x80000408
 	set_checksums 1
@@ -3386,7 +3386,7 @@ run_test 77g "checksum error on OST write ======================"
 test_77h() { # bug 10889
 	[ $(lctl get_param -n devices | grep -c obdfilter) -eq 0 ] && \
 		skip "remote OST" && return
-	[ ! -f $DIR/f77g ] && skip "requires 77g - skipping" && return  
+	[ ! -f $DIR/f77g ] && skip "requires 77g - skipping" && return
 	cancel_lru_locks osc
 	#define OBD_FAIL_OST_CHECKSUM_SEND          0x21b
 	lctl set_param fail_loc=0x8000021b
@@ -3483,15 +3483,15 @@ test_79() { # bug 12743
 
         ALLOWANCE=$((64 * $OSTCOUNT))
 
-        if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||  
+        if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
            [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
                 error "df total($DFTOTAL) mismatch OST total($BKTOTAL)"
         fi
-        if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] || 
+        if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
            [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
                 error "df free($DFFREE) mismatch OST free($BKFREE)"
         fi
-        if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] || 
+        if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
            [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
                 error "df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
         fi
@@ -3642,7 +3642,7 @@ test_101() {
 	if [ $(($discard * 10)) -gt $nreads ] ;then
 		lctl get_param osc.*.rpc_stats
 		lctl get_param llite.*.read_ahead_stats
-		error "too many ($discard) discarded pages" 
+		error "too many ($discard) discarded pages"
 	fi
 	rm -f $DIR/$tfile || true
 }
@@ -3703,7 +3703,7 @@ test_101b() {
 	local ITERATION=$((FILE_LENGTH/STRIDE_SIZE))
 	# prepare the read-ahead file
 	setup_test101
-	cancel_lru_locks osc 
+	cancel_lru_locks osc
 	for BIDX in 2 4 8 16 32 64 128 256
 	do
 		local BSIZE=$((BIDX*4096))
@@ -3726,18 +3726,18 @@ setup_test102() {
 	[ "$SETUP_TEST102" = "yes" ] && return
 	mkdir -p $DIR/$tdir
 	STRIPE_SIZE=65536
-	STRIPE_COUNT=4 
+	STRIPE_COUNT=4
 	STRIPE_OFFSET=2
 
 	trap cleanup_test102 EXIT
 	cd $DIR
 	$SETSTRIPE $tdir -s $STRIPE_SIZE -i $STRIPE_OFFSET -c $STRIPE_COUNT
-	cd $DIR/$tdir 
+	cd $DIR/$tdir
 	for num in 1 2 3 4
 	do
 		for count in 1 2 3 4
 		do
-			for offset in 0 1 2 3 
+			for offset in 0 1 2 3
 			do
 				local stripe_size=`expr $STRIPE_SIZE \* $num`
 				local file=file"$num-$offset-$count"
@@ -3747,7 +3747,7 @@ setup_test102() {
 	done
 
 	cd $DIR
-	star -c  f=$TMP/f102.tar $tdir 
+	star -c  f=$TMP/f102.tar $tdir
 	SETUP_TEST102=yes
 }
 
@@ -3774,7 +3774,7 @@ test_102a() {
         setfattr -n trusted.name1 -v value1 $testfile || error
         [ "`getfattr -n trusted.name1 $testfile 2> /dev/null | \
         grep "trusted.name1"`" == "trusted.name1=\"value1\"" ] || error
- 
+
         setfattr -n user.author1 -v author1 $testfile || error
         [ "`getfattr -n user.author1 $testfile 2> /dev/null | \
         grep "user.author1"`" == "user.author1=\"author1\"" ] || error
@@ -3785,7 +3785,7 @@ test_102a() {
         [ `getfattr -d -m "^trusted" $testfile 2> /dev/null | \
         grep "trusted.name" | wc -l` -eq 3 ] || error
 
- 
+
         setfattr -n user.author2 -v author2 $testfile || error
         setfattr -n user.author3 -v author3 $testfile || error
         [ `getfattr -d -m "^user" $testfile 2> /dev/null | \
@@ -3874,12 +3874,12 @@ compare_stripe_info1() {
 	do
 		for count in 1 2 3 4
 		do
-			for offset in 0 1 2 3 
+			for offset in 0 1 2 3
 			do
 				local size=`expr $STRIPE_SIZE \* $num`
 				local file=file"$num-$offset-$count"
 				local tmp_file=out
-				$GETSTRIPE -v $file > $tmp_file 
+				$GETSTRIPE -v $file > $tmp_file
 				get_stripe_info  $tmp_file
 				if test $stripe_size -ne $size
 				then
@@ -3904,7 +3904,7 @@ compare_stripe_info2() {
 	do
 		for count in 1 2 3 4
 		do
-			for offset in 0 1 2 3 
+			for offset in 0 1 2 3
 			do
 				local size=`expr $STRIPE_SIZE \* $num`
 				local file=file"$num-$offset-$count"
@@ -3931,7 +3931,7 @@ compare_stripe_info2() {
 
 test_102d() {
 	# b10930: star test for trusted.lov xattr
-	star --xhelp 2>&1 | grep -q nolustre  
+	star --xhelp 2>&1 | grep -q nolustre
 	if [ $? -ne 0 ]
 	then
 		skip "being skipped because a lustre-aware star is not installed." && return
@@ -3948,7 +3948,7 @@ run_test 102d "star restore stripe info from tarfile,not keep osts ==========="
 
 test_102e() {
 	# b10930: star test for trusted.lov xattr
-	star --xhelp 2>&1 | grep -q nolustre  
+	star --xhelp 2>&1 | grep -q nolustre
 	[ $? -ne 0 ] && skip "lustre-aware star is not installed" && return
 	[ "$OSTCOUNT" -lt "4" ] && skip "skipping 4-stripe test" && return
 	setup_test102
@@ -3961,7 +3961,7 @@ run_test 102e "star restore stripe info from tarfile, keep osts ==========="
 
 test_102f() {
 	# b10930: star test for trusted.lov xattr
-	star --xhelp 2>&1 | grep -q nolustre  
+	star --xhelp 2>&1 | grep -q nolustre
 	[ $? -ne 0 ] && skip "lustre-aware star is not installed" && return
 	[ "$OSTCOUNT" -lt "4" ] && skip "skipping 4-stripe test" && return
 	setup_test102
@@ -3975,7 +3975,7 @@ run_test 102f "star copy files, not keep osts ==========="
 
 test_102g() {
 	# b10930: star test for trusted.lov xattr
-	star --xhelp 2>&1 | grep -q nolustre  
+	star --xhelp 2>&1 | grep -q nolustre
 	[ $? -ne 0 ] && skip "lustre-aware star is not installed" && return
 	[ "$OSTCOUNT" -lt "4" ] && skip "skipping 4-stripe test" && return
 	setup_test102
@@ -4198,8 +4198,8 @@ free_min_max () {
 		MINV=${AVAIL[i]}; MINI=$i
 	    fi
 	done
-	echo Min free space: OST $MINI: $MINV 
-	echo Max free space: OST $MAXI: $MAXV 
+	echo Min free space: OST $MINI: $MINV
+	echo Max free space: OST $MAXI: $MAXV
 }
 
 test_116() {
@@ -4264,14 +4264,14 @@ test_116() {
 	free_min_max
 	DIFF2=$(($MAXV - $MINV))
 	echo "free space delta: orig $DIFF final $DIFF2"
-	[ $DIFF2 -gt $DIFF ] && echo "delta got worse!" 
+	[ $DIFF2 -gt $DIFF ] && echo "delta got worse!"
 	DIFF=$(($MINV1 - ${AVAIL[$MINI1]}))
 	echo "Wrote $DIFF to smaller OST $MINI1"
 	DIFF2=$(($MAXV1 - ${AVAIL[$MAXI1]}))
 	echo "Wrote $DIFF2 to larger OST $MAXI1"
 	[ $DIFF -gt 0 ] && echo "Wrote $(($DIFF2 * 100 / $DIFF - 100))% more data to larger OST $MAXI1"
 
-	# Figure out which files were written where 
+	# Figure out which files were written where
 	UUID=$(lctl get_param -n lov.${FSNAME}-clilov-*.target_obd | awk '/'$MINI1': / {print $2; exit}')
 	echo $UUID
         MINC=$($GETSTRIPE --obd $UUID $DIR/$tdir | wc -l)
@@ -4459,7 +4459,7 @@ test_118f() {
 	fi
 	
         lctl set_param fail_loc=0x0
-        
+
         LOCKED=$(lctl get_param -n "llite.*.dump_page_cache" | grep -c locked)
         DIRTY=$(lctl get_param -n "llite.*.dump_page_cache" | grep -c dirty)
         WRITEBACK=$(lctl get_param -n "llite.*.dump_page_cache" | grep -c writeback)
@@ -4847,7 +4847,7 @@ test_120g() {
         cancel_lru_locks mdc
         cancel_lru_locks osc
         t0=`date +%s`
-        
+
         can0=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'`
         blk0=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
         createmany -o $DIR/$tdir/f $count
@@ -4979,9 +4979,9 @@ test_124a() {
 
         # use touch to produce $NR new locks
         log "create $NR files at $DIR/$tdir"
-        createmany -o $DIR/$tdir/f $NR || 
-                error "failed to create $NR files in $DIR/$tdir" 
-        
+        createmany -o $DIR/$tdir/f $NR ||
+                error "failed to create $NR files in $DIR/$tdir"
+
         cancel_lru_locks mdc
         ls -l $DIR/$tdir > /dev/null
 
@@ -5044,7 +5044,7 @@ test_124b() {
 	[ -z "`lctl get_param -n mdc.*.connect_flags | grep lru_resize`" ] && \
                skip "no lru resize on server" && return 0
 
-        # even for cmd no matter what metadata namespace to use for getting 
+        # even for cmd no matter what metadata namespace to use for getting
         # the limit, we use appropriate.
         LIMIT=`lctl get_param -n ldlm.namespaces.*mdc*.pool.limit`
 
@@ -5053,7 +5053,7 @@ test_124b() {
                 NR=$LIMIT
         fi
         lru_resize_disable mdc
-        mkdir -p $DIR/$tdir/disable_lru_resize || 
+        mkdir -p $DIR/$tdir/disable_lru_resize ||
 		error "failed to create $DIR/$tdir/disable_lru_resize"
 
         createmany -o $DIR/$tdir/disable_lru_resize/f $NR
@@ -5077,7 +5077,7 @@ test_124b() {
         unlinkmany $DIR/$tdir/disable_lru_resize/f $NR
 
         lru_resize_enable mdc
-        mkdir -p $DIR/$tdir/enable_lru_resize || 
+        mkdir -p $DIR/$tdir/enable_lru_resize ||
 		error "failed to create $DIR/$tdir/enable_lru_resize"
 
         createmany -o $DIR/$tdir/enable_lru_resize/f $NR
@@ -5142,15 +5142,15 @@ test_127() { # bug 15521
                 echo "got $COUNT $NAME"
 
                 case $NAME in
-                        ost_read|ost_write)
+                        read_bytes|write_bytes)
                         [ $MIN -lt 4096 ] && error "min is too small: $MIN"
                         [ $MIN -gt $FSIZE ] && error "min is too big: $MIN"
                         [ $MAX -lt 4096 ] && error "max is too small: $MAX"
                         [ $MAX -gt $FSIZE ] && error "max is too big: $MAX"
                         [ $SUM -ne $FSIZE ] && error "sum is wrong: $SUM"
-                        [ $SUMSQ -lt $(((FSIZE /4096) * (4096 * 4096))) ] && 
+                        [ $SUMSQ -lt $(((FSIZE /4096) * (4096 * 4096))) ] &&
                                 error "sumsquare is too small: $SUMSQ"
-                        [ $SUMSQ -gt $((FSIZE * FSIZE)) ] && 
+                        [ $SUMSQ -gt $((FSIZE * FSIZE)) ] &&
                                 error "sumsquare is too big: $SUMSQ"
                         ;;
                         *) ;;
@@ -5158,8 +5158,8 @@ test_127() { # bug 15521
         done < $DIR/${tfile}.tmp
 
         #check that we actually got some stats
-        [ "$ost_read" ] || error "no read done"
-        [ "$ost_write" ] || error "no write done"
+        [ "$read_bytes" ] || error "no read done"
+        [ "$write_bytes" ] || error "no write done"
 }
 run_test 127 "verify the client stats are sane"
 
@@ -5180,7 +5180,7 @@ test_129() {
         [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return 0
 
         DEV=$(basename $(do_facet mds lctl get_param -n mds.*.mntdev))
-        [ -z "$DEV" ] && error "can't access mds mntdev" 
+        [ -z "$DEV" ] && error "can't access mds mntdev"
         EFBIG=27
         LDPROC=/proc/fs/ldiskfs/$DEV/max_dir_size
         MAX=16384