blk-mq-debugfs.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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_debugfs_attr {
  7. const char *name;
  8. umode_t mode;
  9. int (*show)(void *, struct seq_file *);
  10. ssize_t (*write)(void *, const char __user *, size_t, loff_t *);
  11. /* Set either .show or .seq_ops. */
  12. const struct seq_operations *seq_ops;
  13. };
  14. int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq);
  15. int blk_mq_debugfs_rq_show(struct seq_file *m, void *v);
  16. int blk_mq_debugfs_register(struct request_queue *q);
  17. void blk_mq_debugfs_unregister(struct request_queue *q);
  18. int 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. int blk_mq_debugfs_register_hctxs(struct request_queue *q);
  22. void blk_mq_debugfs_unregister_hctxs(struct request_queue *q);
  23. int blk_mq_debugfs_register_sched(struct request_queue *q);
  24. void blk_mq_debugfs_unregister_sched(struct request_queue *q);
  25. int 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. #else
  29. static inline int blk_mq_debugfs_register(struct request_queue *q)
  30. {
  31. return 0;
  32. }
  33. static inline void blk_mq_debugfs_unregister(struct request_queue *q)
  34. {
  35. }
  36. static inline int blk_mq_debugfs_register_hctx(struct request_queue *q,
  37. struct blk_mq_hw_ctx *hctx)
  38. {
  39. return 0;
  40. }
  41. static inline void blk_mq_debugfs_unregister_hctx(struct blk_mq_hw_ctx *hctx)
  42. {
  43. }
  44. static inline int blk_mq_debugfs_register_hctxs(struct request_queue *q)
  45. {
  46. return 0;
  47. }
  48. static inline void blk_mq_debugfs_unregister_hctxs(struct request_queue *q)
  49. {
  50. }
  51. static inline int blk_mq_debugfs_register_sched(struct request_queue *q)
  52. {
  53. return 0;
  54. }
  55. static inline void blk_mq_debugfs_unregister_sched(struct request_queue *q)
  56. {
  57. }
  58. static inline int blk_mq_debugfs_register_sched_hctx(struct request_queue *q,
  59. struct blk_mq_hw_ctx *hctx)
  60. {
  61. return 0;
  62. }
  63. static inline void blk_mq_debugfs_unregister_sched_hctx(struct blk_mq_hw_ctx *hctx)
  64. {
  65. }
  66. #endif
  67. #ifdef CONFIG_BLK_DEBUG_FS_ZONED
  68. int queue_zone_wlock_show(void *data, struct seq_file *m);
  69. #else
  70. static inline int queue_zone_wlock_show(void *data, struct seq_file *m)
  71. {
  72. return 0;
  73. }
  74. #endif
  75. #endif