xref: /linux/block/blk-mq-debugfs.h (revision 507e190946297c34a27d9366b0661d5e506fdd03)
1 #ifndef INT_BLK_MQ_DEBUGFS_H
2 #define INT_BLK_MQ_DEBUGFS_H
3 
4 #ifdef CONFIG_BLK_DEBUG_FS
5 
6 #include <linux/seq_file.h>
7 
8 struct blk_mq_debugfs_attr {
9 	const char *name;
10 	umode_t mode;
11 	int (*show)(void *, struct seq_file *);
12 	ssize_t (*write)(void *, const char __user *, size_t, loff_t *);
13 	/* Set either .show or .seq_ops. */
14 	const struct seq_operations *seq_ops;
15 };
16 
17 int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq);
18 int blk_mq_debugfs_rq_show(struct seq_file *m, void *v);
19 
20 int blk_mq_debugfs_register(struct request_queue *q);
21 void blk_mq_debugfs_unregister(struct request_queue *q);
22 int blk_mq_debugfs_register_hctx(struct request_queue *q,
23 				 struct blk_mq_hw_ctx *hctx);
24 void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx);
25 int blk_mq_debugfs_register_hctxs(struct request_queue *q);
26 void blk_mq_debugfs_unregister_hctxs(struct request_queue *q);
27 
28 int blk_mq_debugfs_register_sched(struct request_queue *q);
29 void blk_mq_debugfs_unregister_sched(struct request_queue *q);
30 int blk_mq_debugfs_register_sched_hctx(struct request_queue *q,
31 				       struct blk_mq_hw_ctx *hctx);
32 void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx);
33 #else
34 static inline int blk_mq_debugfs_register(struct request_queue *q)
35 {
36 	return 0;
37 }
38 
39 static inline void blk_mq_debugfs_unregister(struct request_queue *q)
40 {
41 }
42 
43 static inline int blk_mq_debugfs_register_hctx(struct request_queue *q,
44 					       struct blk_mq_hw_ctx *hctx)
45 {
46 	return 0;
47 }
48 
49 static inline void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx)
50 {
51 }
52 
53 static inline int blk_mq_debugfs_register_hctxs(struct request_queue *q)
54 {
55 	return 0;
56 }
57 
58 static inline void blk_mq_debugfs_unregister_hctxs(struct request_queue *q)
59 {
60 }
61 
62 static inline int blk_mq_debugfs_register_sched(struct request_queue *q)
63 {
64 	return 0;
65 }
66 
67 static inline void blk_mq_debugfs_unregister_sched(struct request_queue *q)
68 {
69 }
70 
71 static inline int blk_mq_debugfs_register_sched_hctx(struct request_queue *q,
72 						     struct blk_mq_hw_ctx *hctx)
73 {
74 	return 0;
75 }
76 
77 static inline void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx)
78 {
79 }
80 #endif
81 
82 #endif
83