]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
blk-mq: Fix poll_stat for new size-based bucketing.
authorStephen Bates <sbates@raithlin.com>
Thu, 20 Apr 2017 22:59:11 +0000 (16:59 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 20 Apr 2017 23:10:48 +0000 (17:10 -0600)
Fixes an issue where the size of the poll_stat array in request_queue
does not match the size expected by the new size based bucketing for
IO completion polling.

Fixes: 720b8ccc4500 ("blk-mq: Add a polling specific stats function")
Signed-off-by: Stephen Bates <sbates@raithlin.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-mq-debugfs.c
block/blk-mq.c
include/linux/blkdev.h

index df9b688b877c08c53b6a14336540fe3d87d2ead8..3057641d5d15263197524e904486d095c45a4673 100644 (file)
@@ -159,14 +159,17 @@ static void print_stat(struct seq_file *m, struct blk_rq_stat *stat)
 static int queue_poll_stat_show(struct seq_file *m, void *v)
 {
        struct request_queue *q = m->private;
+       int bucket;
 
-       seq_puts(m, "read: ");
-       print_stat(m, &q->poll_stat[READ]);
-       seq_puts(m, "\n");
+       for (bucket = 0; bucket < BLK_MQ_POLL_STATS_BKTS/2; bucket++) {
+               seq_printf(m, "read  (%d Bytes): ", 1 << (9+bucket));
+               print_stat(m, &q->poll_stat[2*bucket]);
+               seq_puts(m, "\n");
 
-       seq_puts(m, "write: ");
-       print_stat(m, &q->poll_stat[WRITE]);
-       seq_puts(m, "\n");
+               seq_printf(m, "write (%d Bytes): ",  1 << (9+bucket));
+               print_stat(m, &q->poll_stat[2*bucket+1]);
+               seq_puts(m, "\n");
+       }
        return 0;
 }
 
index 47b81063872929f8e549295807fb08ce5e83edb7..b6dc9ba38e35dec65a8f3e9dd1dcbda46ebe41db 100644 (file)
@@ -42,8 +42,6 @@ static LIST_HEAD(all_q_list);
 static void blk_mq_poll_stats_start(struct request_queue *q);
 static void blk_mq_poll_stats_fn(struct blk_stat_callback *cb);
 
-/* Must be consisitent with function below */
-#define BLK_MQ_POLL_STATS_BKTS 16
 static int blk_mq_poll_stats_bkt(const struct request *rq)
 {
        int ddir, bytes, bucket;
index 6c4ab0d4a160fd6ee59e213198be48fa5d2beb6f..6c247861cb66deddb884e7047cef6a763ba2b029 100644 (file)
@@ -46,6 +46,9 @@ struct blk_stat_callback;
 #define BLKDEV_MIN_RQ  4
 #define BLKDEV_MAX_RQ  128     /* Default maximum */
 
+/* Must be consisitent with blk_mq_poll_stats_bkt() */
+#define BLK_MQ_POLL_STATS_BKTS 16
+
 /*
  * Maximum number of blkcg policies allowed to be registered concurrently.
  * Defined here to simplify include dependency.
@@ -517,7 +520,7 @@ struct request_queue {
        int                     poll_nsec;
 
        struct blk_stat_callback        *poll_cb;
-       struct blk_rq_stat      poll_stat[2];
+       struct blk_rq_stat      poll_stat[BLK_MQ_POLL_STATS_BKTS];
 
        struct timer_list       timeout;
        struct work_struct      timeout_work;