Fix unplug histogram placement.
authorAlan D. Brunelle <Alan.Brunelle@hp.com>
Wed, 18 Apr 2007 12:53:52 +0000 (14:53 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 18 Apr 2007 12:53:52 +0000 (14:53 +0200)
Signed-off-by: Alan D. Brunelle <Alan.Brunelle@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
btt/unplug_hist.c

index 03b009b20fc231d996a6aecc8f2e1e1b9409ac52..4971f31298fa3d9f1b85f06554fbcb4f9ee8fc24 100644 (file)
@@ -30,8 +30,6 @@ struct hist_bkt {
        int hist[NBKTS * sizeof(int)];
 };
 
-static struct file_info *unplug_hist_files = NULL;
-
 void *unplug_hist_init(__u32 device)
 {
        struct hist_bkt *hbp;
@@ -54,9 +52,12 @@ void unplug_hist_add(struct io *u_iop)
        dip = __dip_find(u_iop->t.device);
        if (dip && dip->unplug_hist_handle) {
                __u64 *val = u_iop->pdu;
-               int n_unplugs = be64_to_cpu(*val);
-               struct hist_bkt * hbp = dip->unplug_hist_handle;
-               int idx = (n_unplugs / BKT_WIDTH) <= MAX_BKT ?: EXCESS_BKT;
+               int idx, n_unplugs = be64_to_cpu(*val);
+               struct hist_bkt *hbp = dip->unplug_hist_handle;
+
+               idx = (n_unplugs / BKT_WIDTH);
+               if (idx > MAX_BKT)
+                       idx = EXCESS_BKT;
 
                assert((0 <= idx) && (idx <= EXCESS_BKT));
                hbp->hist[idx]++;