From: Keith Busch <kbusch@xxxxxxxxxx> This way drivers that want this value don't need to concern themselves with the CONFIG_BLK_DEV_INTEGRITY setting. Signed-off-by: Keith Busch <kbusch@xxxxxxxxxx> --- include/linux/blk-mq.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 8d304b1d16b15..3984aad9bf64a 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -228,6 +228,18 @@ static inline unsigned short req_get_ioprio(struct request *req) return req->ioprio; } +#ifdef CONFIG_BLK_DEV_INTEGRITY +static inline unsigned short blk_rq_integrity_segments(struct request *rq) +{ + return rq->nr_integrity_segments; +} +#else +static inline unsigned short blk_rq_integrity_segments(struct request *rq) +{ + return 0; +} +#endif + #define rq_data_dir(rq) (op_is_write(req_op(rq)) ? WRITE : READ) #define rq_dma_dir(rq) \ -- 2.43.5