Commit b6559d8f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: fold bio_cur_bytes into blk_rq_cur_bytes

Fold bio_cur_bytes into the only caller.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211012161804.991559-5-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8addffd6
...@@ -69,14 +69,6 @@ static inline bool bio_no_advance_iter(const struct bio *bio) ...@@ -69,14 +69,6 @@ static inline bool bio_no_advance_iter(const struct bio *bio)
bio_op(bio) == REQ_OP_WRITE_ZEROES; bio_op(bio) == REQ_OP_WRITE_ZEROES;
} }
static inline unsigned int bio_cur_bytes(struct bio *bio)
{
if (bio_has_data(bio))
return bio_iovec(bio).bv_len;
else /* dataless requests such as discard */
return bio->bi_iter.bi_size;
}
static inline void *bio_data(struct bio *bio) static inline void *bio_data(struct bio *bio)
{ {
if (bio_has_data(bio)) if (bio_has_data(bio))
......
...@@ -927,7 +927,11 @@ static inline unsigned int blk_rq_bytes(const struct request *rq) ...@@ -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) 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); unsigned int blk_rq_err_bytes(const struct request *rq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment