diff options
author | Christoph Hellwig <hch@lst.de> | 2023-02-03 16:06:12 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-02-03 08:20:54 -0700 |
commit | d58cdfae6a22e5079656c487aad669597a0635c8 (patch) | |
tree | b2cfec440f8e45d1b2e75feecf6737b0681870db /block/bio.c | |
parent | 3f13ab7c80fdb0ada86a8e3e818960bc1ccbaa59 (diff) | |
download | linux-stable-d58cdfae6a22e5079656c487aad669597a0635c8.tar.gz linux-stable-d58cdfae6a22e5079656c487aad669597a0635c8.tar.bz2 linux-stable-d58cdfae6a22e5079656c487aad669597a0635c8.zip |
block: factor out a bvec_set_page helper
Add a helper to initialize a bvec based of a page pointer. This will help
removing various open code bvec initializations.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20230203150634.3199647-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bio.c')
-rw-r--r-- | block/bio.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/block/bio.c b/block/bio.c index d7fbc7adfc50..71e411a0c129 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1029,10 +1029,7 @@ int bio_add_hw_page(struct request_queue *q, struct bio *bio, if (bio->bi_vcnt >= queue_max_segments(q)) return 0; - bvec = &bio->bi_io_vec[bio->bi_vcnt]; - bvec->bv_page = page; - bvec->bv_len = len; - bvec->bv_offset = offset; + bvec_set_page(&bio->bi_io_vec[bio->bi_vcnt], page, len, offset); bio->bi_vcnt++; bio->bi_iter.bi_size += len; return len; @@ -1108,15 +1105,10 @@ EXPORT_SYMBOL_GPL(bio_add_zone_append_page); void __bio_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int off) { - struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt]; - WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); WARN_ON_ONCE(bio_full(bio, len)); - bv->bv_page = page; - bv->bv_offset = off; - bv->bv_len = len; - + bvec_set_page(&bio->bi_io_vec[bio->bi_vcnt], page, len, off); bio->bi_iter.bi_size += len; bio->bi_vcnt++; } |