aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2018-02-27 19:32:13 -0500
committerJens Axboe <axboe@kernel.dk>2018-02-28 14:23:35 -0500
commit1209cb7fa4afcd7f652a70e1d2028686ec28a7a5 (patch)
tree03e1871e54b7be8eef80e70e3e22623809d6f8ac
parent025aecd8bdfed9ee1325d3f21d0f84b3622bdda5 (diff)
blk-mq-debugfs: Reorder queue show and store methods
Make sure that the queue show and store methods are contiguous and also that these appear in alphabetical order. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Omar Sandoval <osandov@fb.com> Cc: Damien Le Moal <damien.lemoal@wdc.com> Cc: Ming Lei <ming.lei@redhat.com> Cc: Hannes Reinecke <hare@suse.de> Cc: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-mq-debugfs.c130
1 files changed, 65 insertions, 65 deletions
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 21cbc1f071c6..9547569aa619 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -24,6 +24,64 @@
24#include "blk-mq-debugfs.h" 24#include "blk-mq-debugfs.h"
25#include "blk-mq-tag.h" 25#include "blk-mq-tag.h"
26 26
27static void print_stat(struct seq_file *m, struct blk_rq_stat *stat)
28{
29 if (stat->nr_samples) {
30 seq_printf(m, "samples=%d, mean=%lld, min=%llu, max=%llu",
31 stat->nr_samples, stat->mean, stat->min, stat->max);
32 } else {
33 seq_puts(m, "samples=0");
34 }
35}
36
37static int queue_poll_stat_show(void *data, struct seq_file *m)
38{
39 struct request_queue *q = data;
40 int bucket;
41
42 for (bucket = 0; bucket < BLK_MQ_POLL_STATS_BKTS/2; bucket++) {
43 seq_printf(m, "read (%d Bytes): ", 1 << (9+bucket));
44 print_stat(m, &q->poll_stat[2*bucket]);
45 seq_puts(m, "\n");
46
47 seq_printf(m, "write (%d Bytes): ", 1 << (9+bucket));
48 print_stat(m, &q->poll_stat[2*bucket+1]);
49 seq_puts(m, "\n");
50 }
51 return 0;
52}
53
54static void *queue_requeue_list_start(struct seq_file *m, loff_t *pos)
55 __acquires(&q->requeue_lock)
56{
57 struct request_queue *q = m->private;
58
59 spin_lock_irq(&q->requeue_lock);
60 return seq_list_start(&q->requeue_list, *pos);
61}
62
63static void *queue_requeue_list_next(struct seq_file *m, void *v, loff_t *pos)
64{
65 struct request_queue *q = m->private;
66
67 return seq_list_next(v, &q->requeue_list, pos);
68}
69
70static void queue_requeue_list_stop(struct seq_file *m, void *v)
71 __releases(&q->requeue_lock)
72{
73 struct request_queue *q = m->private;
74
75 spin_unlock_irq(&q->requeue_lock);
76}
77
78static const struct seq_operations queue_requeue_list_seq_ops = {
79 .start = queue_requeue_list_start,
80 .next = queue_requeue_list_next,
81 .stop = queue_requeue_list_stop,
82 .show = blk_mq_debugfs_rq_show,
83};
84
27static int blk_flags_show(struct seq_file *m, const unsigned long flags, 85static int blk_flags_show(struct seq_file *m, const unsigned long flags,
28 const char *const *flag_name, int flag_name_count) 86 const char *const *flag_name, int flag_name_count)
29{ 87{
@@ -125,16 +183,6 @@ inval:
125 return count; 183 return count;
126} 184}
127 185
128static void print_stat(struct seq_file *m, struct blk_rq_stat *stat)
129{
130 if (stat->nr_samples) {
131 seq_printf(m, "samples=%d, mean=%lld, min=%llu, max=%llu",
132 stat->nr_samples, stat->mean, stat->min, stat->max);
133 } else {
134 seq_puts(m, "samples=0");
135 }
136}
137
138static int queue_write_hint_show(void *data, struct seq_file *m) 186static int queue_write_hint_show(void *data, struct seq_file *m)
139{ 187{
140 struct request_queue *q = data; 188 struct request_queue *q = data;
@@ -158,22 +206,13 @@ static ssize_t queue_write_hint_store(void *data, const char __user *buf,
158 return count; 206 return count;
159} 207}
160 208
161static int queue_poll_stat_show(void *data, struct seq_file *m) 209static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = {
162{ 210 { "poll_stat", 0400, queue_poll_stat_show },
163 struct request_queue *q = data; 211 { "requeue_list", 0400, .seq_ops = &queue_requeue_list_seq_ops },
164 int bucket; 212 { "state", 0600, queue_state_show, queue_state_write },
165 213 { "write_hints", 0600, queue_write_hint_show, queue_write_hint_store },
166 for (bucket = 0; bucket < BLK_MQ_POLL_STATS_BKTS/2; bucket++) { 214 { },
167 seq_printf(m, "read (%d Bytes): ", 1 << (9+bucket)); 215};
168 print_stat(m, &q->poll_stat[2*bucket]);
169 seq_puts(m, "\n");
170
171 seq_printf(m, "write (%d Bytes): ", 1 << (9+bucket));
172 print_stat(m, &q->poll_stat[2*bucket+1]);
173 seq_puts(m, "\n");
174 }
175 return 0;
176}
177 216
178#define HCTX_STATE_NAME(name) [BLK_MQ_S_##name] = #name 217#define HCTX_STATE_NAME(name) [BLK_MQ_S_##name] = #name
179static const char *const hctx_state_name[] = { 218static const char *const hctx_state_name[] = {
@@ -327,37 +366,6 @@ int blk_mq_debugfs_rq_show(struct seq_file *m, void *v)
327} 366}
328EXPORT_SYMBOL_GPL(blk_mq_debugfs_rq_show); 367EXPORT_SYMBOL_GPL(blk_mq_debugfs_rq_show);
329 368
330static void *queue_requeue_list_start(struct seq_file *m, loff_t *pos)
331 __acquires(&q->requeue_lock)
332{
333 struct request_queue *q = m->private;
334
335 spin_lock_irq(&q->requeue_lock);
336 return seq_list_start(&q->requeue_list, *pos);
337}
338
339static void *queue_requeue_list_next(struct seq_file *m, void *v, loff_t *pos)
340{
341 struct request_queue *q = m->private;
342
343 return seq_list_next(v, &q->requeue_list, pos);
344}
345
346static void queue_requeue_list_stop(struct seq_file *m, void *v)
347 __releases(&q->requeue_lock)
348{
349 struct request_queue *q = m->private;
350
351 spin_unlock_irq(&q->requeue_lock);
352}
353
354static const struct seq_operations queue_requeue_list_seq_ops = {
355 .start = queue_requeue_list_start,
356 .next = queue_requeue_list_next,
357 .stop = queue_requeue_list_stop,
358 .show = blk_mq_debugfs_rq_show,
359};
360
361static void *hctx_dispatch_start(struct seq_file *m, loff_t *pos) 369static void *hctx_dispatch_start(struct seq_file *m, loff_t *pos)
362 __acquires(&hctx->lock) 370 __acquires(&hctx->lock)
363{ 371{
@@ -747,14 +755,6 @@ static const struct file_operations blk_mq_debugfs_fops = {
747 .release = blk_mq_debugfs_release, 755 .release = blk_mq_debugfs_release,
748}; 756};
749 757
750static const struct blk_mq_debugfs_attr blk_mq_debugfs_queue_attrs[] = {
751 {"poll_stat", 0400, queue_poll_stat_show},
752 {"requeue_list", 0400, .seq_ops = &queue_requeue_list_seq_ops},
753 {"state", 0600, queue_state_show, queue_state_write},
754 {"write_hints", 0600, queue_write_hint_show, queue_write_hint_store},
755 {},
756};
757
758static const struct blk_mq_debugfs_attr blk_mq_debugfs_hctx_attrs[] = { 758static const struct blk_mq_debugfs_attr blk_mq_debugfs_hctx_attrs[] = {
759 {"state", 0400, hctx_state_show}, 759 {"state", 0400, hctx_state_show},
760 {"flags", 0400, hctx_flags_show}, 760 {"flags", 0400, hctx_flags_show},