Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blk-mq: Fix poll_stat for new size-based bucketing.
@ 2017-04-20 22:59 sbates
  2017-04-20 23:12 ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: sbates @ 2017-04-20 22:59 UTC (permalink / raw)


From: Stephen Bates <sbates@raithlin.com>

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.

Should be applied on top of commit 720b8ccc4500 ("blk-mq: Add a
polling specific stats function").

Signed-off-by: Stephen Bates <sbates at raithlin.com>
---
 block/blk-mq-debugfs.c | 15 +++++++++------
 block/blk-mq.c         |  8 ++++----
 include/linux/blkdev.h |  5 ++++-
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index df9b688..3057641 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -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;
 }
 
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9d7645f..81f7c99 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 6c4ab0d..6c24786 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] blk-mq: Fix poll_stat for new size-based bucketing.
  2017-04-20 22:59 [PATCH] blk-mq: Fix poll_stat for new size-based bucketing sbates
@ 2017-04-20 23:12 ` Jens Axboe
  2017-04-20 23:13   ` Stephen  Bates
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2017-04-20 23:12 UTC (permalink / raw)


On 04/20/2017 04:59 PM, sbates@raithlin.com wrote:
> From: Stephen Bates <sbates at raithlin.com>
> 
> 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.
> 
> Should be applied on top of commit 720b8ccc4500 ("blk-mq: Add a
> polling specific stats function").

Thanks, added. BTW, in the future, we have a format for specifying
if a patch fixes another patch. This should have been:

Fixes: 720b8ccc4500 ("blk-mq: Add a polling specific stats function")

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] blk-mq: Fix poll_stat for new size-based bucketing.
  2017-04-20 23:12 ` Jens Axboe
@ 2017-04-20 23:13   ` Stephen  Bates
  2017-04-20 23:16     ` Jens Axboe
  2017-04-20 23:57     ` Sagi Grimberg
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen  Bates @ 2017-04-20 23:13 UTC (permalink / raw)



> Thanks, added. BTW, in the future, we have a format for specifying
> if a patch fixes another patch. This should have been:

Thanks!

> Fixes: 720b8ccc4500 ("blk-mq: Add a polling specific stats function")

Duly noted for next time. Apologies for the miss?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] blk-mq: Fix poll_stat for new size-based bucketing.
  2017-04-20 23:13   ` Stephen  Bates
@ 2017-04-20 23:16     ` Jens Axboe
  2017-04-20 23:57     ` Sagi Grimberg
  1 sibling, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2017-04-20 23:16 UTC (permalink / raw)


On 04/20/2017 05:13 PM, Stephen  Bates wrote:
> 
>> Thanks, added. BTW, in the future, we have a format for specifying
>> if a patch fixes another patch. This should have been:
> 
> Thanks!
> 
>> Fixes: 720b8ccc4500 ("blk-mq: Add a polling specific stats function")
> 
> Duly noted for next time. Apologies for the miss?

No worries, I fixed it up for you while committing.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] blk-mq: Fix poll_stat for new size-based bucketing.
  2017-04-20 23:13   ` Stephen  Bates
  2017-04-20 23:16     ` Jens Axboe
@ 2017-04-20 23:57     ` Sagi Grimberg
  2017-04-21  9:26       ` Stephen  Bates
  1 sibling, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2017-04-20 23:57 UTC (permalink / raw)


>> Thanks, added. BTW, in the future, we have a format for specifying
>> if a patch fixes another patch. This should have been:
>
> Thanks!
>
>> Fixes: 720b8ccc4500 ("blk-mq: Add a polling specific stats function")
>
> Duly noted for next time. Apologies for the miss?

Stephen,

I recommend adding a pretty section to your gitconfig:

[pretty]
         fixes = Fixes: %h (\"%s\")

This way you can run:

git log --pretty=fixes <broken_commit_hash>^!

and get the format for free :)

Cheers,
Sagi.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] blk-mq: Fix poll_stat for new size-based bucketing.
  2017-04-20 23:57     ` Sagi Grimberg
@ 2017-04-21  9:26       ` Stephen  Bates
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen  Bates @ 2017-04-21  9:26 UTC (permalink / raw)


> I recommend adding a pretty section to your gitconfig:
>
>[pretty]
 >        fixes = Fixes: %h (\"%s\")

Thanks Sagi. Duly added!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-21  9:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-20 22:59 [PATCH] blk-mq: Fix poll_stat for new size-based bucketing sbates
2017-04-20 23:12 ` Jens Axboe
2017-04-20 23:13   ` Stephen  Bates
2017-04-20 23:16     ` Jens Axboe
2017-04-20 23:57     ` Sagi Grimberg
2017-04-21  9:26       ` Stephen  Bates

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox