1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef INT_BLK_MQ_DEBUGFS_H 3 #define INT_BLK_MQ_DEBUGFS_H 4 5 #ifdef CONFIG_BLK_DEBUG_FS 6 7 #include <linux/seq_file.h> 8 9 struct blk_mq_hw_ctx; 10 11 struct blk_mq_debugfs_attr { 12 const char *name; 13 umode_t mode; 14 int (*show)(void *, struct seq_file *); 15 ssize_t (*write)(void *, const char __user *, size_t, loff_t *); 16 /* Set either .show or .seq_ops. */ 17 const struct seq_operations *seq_ops; 18 }; 19 20 int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq); 21 int blk_mq_debugfs_rq_show(struct seq_file *m, void *v); 22 23 void blk_mq_debugfs_register(struct request_queue *q); 24 void blk_mq_debugfs_unregister(struct request_queue *q); 25 void blk_mq_debugfs_register_hctx(struct request_queue *q, 26 struct blk_mq_hw_ctx *hctx); 27 void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx); 28 void blk_mq_debugfs_register_hctxs(struct request_queue *q); 29 void blk_mq_debugfs_unregister_hctxs(struct request_queue *q); 30 31 void blk_mq_debugfs_register_sched(struct request_queue *q); 32 void blk_mq_debugfs_unregister_sched(struct request_queue *q); 33 void blk_mq_debugfs_register_sched_hctx(struct request_queue *q, 34 struct blk_mq_hw_ctx *hctx); 35 void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx); 36 37 void blk_mq_debugfs_register_rqos(struct rq_qos *rqos); 38 void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos); 39 void blk_mq_debugfs_unregister_queue_rqos(struct request_queue *q); 40 #else 41 static inline void blk_mq_debugfs_register(struct request_queue *q) 42 { 43 } 44 45 static inline void blk_mq_debugfs_unregister(struct request_queue *q) 46 { 47 } 48 49 static inline void blk_mq_debugfs_register_hctx(struct request_queue *q, 50 struct blk_mq_hw_ctx *hctx) 51 { 52 } 53 54 static inline void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx) 55 { 56 } 57 58 static inline void blk_mq_debugfs_register_hctxs(struct request_queue *q) 59 { 60 } 61 62 static inline void blk_mq_debugfs_unregister_hctxs(struct request_queue *q) 63 { 64 } 65 66 static inline void blk_mq_debugfs_register_sched(struct request_queue *q) 67 { 68 } 69 70 static inline void blk_mq_debugfs_unregister_sched(struct request_queue *q) 71 { 72 } 73 74 static inline void blk_mq_debugfs_register_sched_hctx(struct request_queue *q, 75 struct blk_mq_hw_ctx *hctx) 76 { 77 } 78 79 static inline void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx) 80 { 81 } 82 83 static inline void blk_mq_debugfs_register_rqos(struct rq_qos *rqos) 84 { 85 } 86 87 static inline void blk_mq_debugfs_unregister_rqos(struct rq_qos *rqos) 88 { 89 } 90 91 static inline void blk_mq_debugfs_unregister_queue_rqos(struct request_queue *q) 92 { 93 } 94 #endif 95 96 #ifdef CONFIG_BLK_DEBUG_FS_ZONED 97 int queue_zone_wlock_show(void *data, struct seq_file *m); 98 #else 99 static inline int queue_zone_wlock_show(void *data, struct seq_file *m) 100 { 101 return 0; 102 } 103 #endif 104 105 #endif 106