diff options
author | Christoph Hellwig <hch@lst.de> | 2021-10-12 18:18:00 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-18 06:17:35 -0600 |
commit | b6559d8f9fdd7f0e139161cffea2645bd8d084c6 (patch) | |
tree | 89a116d9bdc2e5fc2306d6ce7acc118cd5869abb /include/linux/blk-mq.h | |
parent | 8addffd657a956944c1b8a74a1c9aabcfc5b4530 (diff) | |
download | lwn-b6559d8f9fdd7f0e139161cffea2645bd8d084c6.tar.gz lwn-b6559d8f9fdd7f0e139161cffea2645bd8d084c6.zip |
block: fold bio_cur_bytes into blk_rq_cur_bytes
Fold bio_cur_bytes into the only caller.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211012161804.991559-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blk-mq.h')
-rw-r--r-- | include/linux/blk-mq.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 0e941f217578..2219e9277118 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -927,7 +927,11 @@ static inline unsigned int blk_rq_bytes(const struct request *rq) static inline int blk_rq_cur_bytes(const struct request *rq) { - return rq->bio ? bio_cur_bytes(rq->bio) : 0; + if (!rq->bio) + return 0; + if (!bio_has_data(rq->bio)) /* dataless requests such as discard */ + return rq->bio->bi_iter.bi_size; + return bio_iovec(rq->bio).bv_len; } unsigned int blk_rq_err_bytes(const struct request *rq); |