diff options
author | Jens Axboe <axboe@fb.com> | 2014-04-16 12:57:18 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-04-16 16:15:46 -0400 |
commit | 49fd524f95cb4cc699d435e0ebb08b1c6220da6d (patch) | |
tree | 1e9c2d2bdc14a6acaaf57b2f127fadea81528aec | |
parent | fb1be43301ce045b5e563416e701573464a2ed96 (diff) |
bsg: update check for rq based driver for blk-mq
bsg currently checks ->request_fn to check whether a queue can
handle struct request. But with blk-mq, we don't have a request_fn
yet are request based. Add a queue_is_rq_based() helper and use
that in bsg, I'm guessing this is not the last place we need to
update for this. Besides, it better explains what is being
checked.
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | block/bsg.c | 2 | ||||
-rw-r--r-- | include/linux/blkdev.h | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/block/bsg.c b/block/bsg.c index 420a5a9f1b23..e5214c148096 100644 --- a/block/bsg.c +++ b/block/bsg.c | |||
@@ -1008,7 +1008,7 @@ int bsg_register_queue(struct request_queue *q, struct device *parent, | |||
1008 | /* | 1008 | /* |
1009 | * we need a proper transport to send commands, not a stacked device | 1009 | * we need a proper transport to send commands, not a stacked device |
1010 | */ | 1010 | */ |
1011 | if (!q->request_fn) | 1011 | if (!queue_is_rq_based(q)) |
1012 | return 0; | 1012 | return 0; |
1013 | 1013 | ||
1014 | bcd = &q->bsg_dev; | 1014 | bcd = &q->bsg_dev; |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 20b26d4e53a2..74ee55fefcf0 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -612,6 +612,15 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) | |||
612 | 612 | ||
613 | #define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0) | 613 | #define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0) |
614 | 614 | ||
615 | /* | ||
616 | * Driver can handle struct request, if it either has an old style | ||
617 | * request_fn defined, or is blk-mq based. | ||
618 | */ | ||
619 | static inline bool queue_is_rq_based(struct request_queue *q) | ||
620 | { | ||
621 | return q->request_fn || q->mq_ops; | ||
622 | } | ||
623 | |||
615 | static inline unsigned int blk_queue_cluster(struct request_queue *q) | 624 | static inline unsigned int blk_queue_cluster(struct request_queue *q) |
616 | { | 625 | { |
617 | return q->limits.cluster; | 626 | return q->limits.cluster; |