summary refs log tree commit diff
path: root/block/blk-mq-debugfs.h
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2017-05-04 08:24:40 -0600
committerJens Axboe <axboe@fb.com>2017-05-04 08:24:40 -0600
commitd332ce091813d11a46144354baa72b755833392f (patch)
treec6f567b7ffea6dc4abf66cd49e2f94d7a9a49410 /block/blk-mq-debugfs.h
parent9c1051aacde828073dbbab5e8e59c0fc802efa9a (diff)
downloadlinux-d332ce091813d11a46144354baa72b755833392f.tar.gz
blk-mq-debugfs: allow schedulers to register debugfs attributes
This provides the infrastructure for schedulers to expose their internal
state through debugfs. We add a list of queue attributes and a list of
hctx attributes to struct elevator_type and wire them up when switching
schedulers.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>

Add missing seq_file.h header in blk-mq-debugfs.h

Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq-debugfs.h')
-rw-r--r--block/blk-mq-debugfs.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/block/blk-mq-debugfs.h b/block/blk-mq-debugfs.h
index 596e9b16d3d1..a5ac21c81ea3 100644
--- a/block/blk-mq-debugfs.h
+++ b/block/blk-mq-debugfs.h
@@ -2,6 +2,18 @@
 #define INT_BLK_MQ_DEBUGFS_H
 
 #ifdef CONFIG_BLK_DEBUG_FS
+
+#include <linux/seq_file.h>
+
+struct blk_mq_debugfs_attr {
+	const char *name;
+	umode_t mode;
+	int (*show)(void *, struct seq_file *);
+	ssize_t (*write)(void *, const char __user *, size_t, loff_t *);
+	/* Set either .show or .seq_ops. */
+	const struct seq_operations *seq_ops;
+};
+
 int blk_mq_debugfs_register(struct request_queue *q);
 void blk_mq_debugfs_unregister(struct request_queue *q);
 int blk_mq_debugfs_register_hctx(struct request_queue *q,
@@ -9,6 +21,12 @@ int blk_mq_debugfs_register_hctx(struct request_queue *q,
 void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx);
 int blk_mq_debugfs_register_hctxs(struct request_queue *q);
 void blk_mq_debugfs_unregister_hctxs(struct request_queue *q);
+
+int blk_mq_debugfs_register_sched(struct request_queue *q);
+void blk_mq_debugfs_unregister_sched(struct request_queue *q);
+int blk_mq_debugfs_register_sched_hctx(struct request_queue *q,
+				       struct blk_mq_hw_ctx *hctx);
+void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx);
 #else
 static inline int blk_mq_debugfs_register(struct request_queue *q)
 {
@@ -37,6 +55,25 @@ static inline int blk_mq_debugfs_register_hctxs(struct request_queue *q)
 static inline void blk_mq_debugfs_unregister_hctxs(struct request_queue *q)
 {
 }
+
+static inline int blk_mq_debugfs_register_sched(struct request_queue *q)
+{
+	return 0;
+}
+
+static inline void blk_mq_debugfs_unregister_sched(struct request_queue *q)
+{
+}
+
+static inline int blk_mq_debugfs_register_sched_hctx(struct request_queue *q,
+						     struct blk_mq_hw_ctx *hctx)
+{
+	return 0;
+}
+
+static inline void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx)
+{
+}
 #endif
 
 #endif