Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+10 -1
+1 -1
block/bsg.c
··· 1008 1008 /* 1009 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 1012 return 0; 1013 1013 1014 1014 bcd = &q->bsg_dev;
+9
include/linux/blkdev.h
··· 612 612 613 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 624 static inline unsigned int blk_queue_cluster(struct request_queue *q) 616 625 { 617 626 return q->limits.cluster;