Message ID | 20170901113631.12323-2-damien.lemoal@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, 2017-09-01 at 20:36 +0900, Damien Le Moal wrote: > diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h > index 14542308d25b..a369174a9679 100644 > --- a/include/linux/blk-mq.h > +++ b/include/linux/blk-mq.h > @@ -5,6 +5,21 @@ > #include <linux/sbitmap.h> > #include <linux/srcu.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; > +}; > + > +#endif > + > struct blk_mq_tags; > struct blk_flush_queue; > > @@ -289,4 +304,9 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq) > for ((i) = 0; (i) < (hctx)->nr_ctx && \ > ({ ctx = (hctx)->ctxs[(i)]; 1; }); (i)++) > > +#ifdef CONFIG_BLK_DEBUG_FS > +int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq); > +int blk_mq_debugfs_rq_show(struct seq_file *m, void *v); > +#endif > + > #endif Hello Damien, Should these definitions perhaps be moved to a new header file, e.g. include/linux/blk-mq-debugfs.h, such that the introduction of more #ifdefs and #include <linux/seq_file.h> in include/linux/blk-mq.h can be avoided? Thanks, Bart.
diff --git a/block/blk-mq-debugfs.h b/block/blk-mq-debugfs.h index a182e6f97565..85759aef53e1 100644 --- a/block/blk-mq-debugfs.h +++ b/block/blk-mq-debugfs.h @@ -3,20 +3,6 @@ #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_rq_show(struct seq_file *m, struct request *rq); -int blk_mq_debugfs_rq_show(struct seq_file *m, void *v); - 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, diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 14542308d25b..a369174a9679 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -5,6 +5,21 @@ #include <linux/sbitmap.h> #include <linux/srcu.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; +}; + +#endif + struct blk_mq_tags; struct blk_flush_queue; @@ -289,4 +304,9 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq) for ((i) = 0; (i) < (hctx)->nr_ctx && \ ({ ctx = (hctx)->ctxs[(i)]; 1; }); (i)++) +#ifdef CONFIG_BLK_DEBUG_FS +int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq); +int blk_mq_debugfs_rq_show(struct seq_file *m, void *v); +#endif + #endif
__blk_mq_debugfs_rq_show() and blk_mq_debugfs_rq_show() are exported symbols but declared in the block internal file block/blk-mq-debugfs.h. Move the declaration of these functions to the public linux/blk-mq.h file to make these functions available to other modules. While at it, also move the definition of the blk_mq_debugfs_attr strcture to allow scheduler modules outside of block to define debugfs attributes. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> --- block/blk-mq-debugfs.h | 14 -------------- include/linux/blk-mq.h | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 14 deletions(-)