+static void record_start_io(struct filter_iobuf *iobuf, int rw, int size,
+ struct obd_export *exp)
+{
+ struct filter_obd *filter = iobuf->dr_filter;
+
+ atomic_inc(&iobuf->dr_numreqs);
+
+ if (rw == OBD_BRW_READ) {
+ atomic_inc(&filter->fo_r_in_flight);
+ lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_R_RPC_HIST],
+ atomic_read(&filter->fo_r_in_flight));
+ lprocfs_oh_tally_log2(&filter->
+ fo_filter_stats.hist[BRW_R_DISK_IOSIZE],
+ size);
+ if (exp->exp_nid_stats && exp->exp_nid_stats->nid_brw_stats) {
+ lprocfs_oh_tally(&exp->exp_nid_stats->nid_brw_stats->
+ hist[BRW_R_RPC_HIST],
+ atomic_read(&filter->fo_r_in_flight));
+ lprocfs_oh_tally_log2(&exp->exp_nid_stats->
+ nid_brw_stats->hist[BRW_R_DISK_IOSIZE],
+ size);
+ }
+ } else {
+ atomic_inc(&filter->fo_w_in_flight);
+ lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_W_RPC_HIST],
+ atomic_read(&filter->fo_w_in_flight));
+ lprocfs_oh_tally_log2(&filter->
+ fo_filter_stats.hist[BRW_W_DISK_IOSIZE],
+ size);
+ if (exp->exp_nid_stats && exp->exp_nid_stats->nid_brw_stats) {
+ lprocfs_oh_tally(&exp->exp_nid_stats->nid_brw_stats->
+ hist[BRW_W_RPC_HIST],
+ atomic_read(&filter->fo_r_in_flight));
+ lprocfs_oh_tally_log2(&exp->exp_nid_stats->
+ nid_brw_stats->hist[BRW_W_DISK_IOSIZE],
+ size);
+ }
+ }
+}
+
+static void record_finish_io(struct filter_iobuf *iobuf, int rw, int rc)
+{
+ struct filter_obd *filter = iobuf->dr_filter;
+
+ /* CAVEAT EMPTOR: possibly in IRQ context
+ * DO NOT record procfs stats here!!! */
+
+ if (rw == OBD_BRW_READ)
+ atomic_dec(&filter->fo_r_in_flight);
+ else
+ atomic_dec(&filter->fo_w_in_flight);
+
+ if (atomic_dec_and_test(&iobuf->dr_numreqs))
+ wake_up(&iobuf->dr_wait);
+}
+