blk-mq-debugfs.h 2.3 KB

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