diff options
author | Christoph Hellwig | 2023-02-03 16:06:12 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-09-23 11:11:08 +0200 |
commit | 00cf1dc13c1f5207693abe59d6e26d8fd0ed7673 (patch) | |
tree | e66fdb21676868596deff17080fad89cf8f2739f /include/linux | |
parent | 2174731a17b04bc01d0c9e68414dca7091a59cbe (diff) |
block: factor out a bvec_set_page helper
[ Upstream commit d58cdfae6a22e5079656c487aad669597a0635c8 ]
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>
Stable-dep-of: 1f0bbf28940c ("nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bvec.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 35c25dff651a..9e3dac51eb26 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -35,6 +35,21 @@ struct bio_vec { unsigned int bv_offset; }; +/** + * bvec_set_page - initialize a bvec based off a struct page + * @bv: bvec to initialize + * @page: page the bvec should point to + * @len: length of the bvec + * @offset: offset into the page + */ +static inline void bvec_set_page(struct bio_vec *bv, struct page *page, + unsigned int len, unsigned int offset) +{ + bv->bv_page = page; + bv->bv_len = len; + bv->bv_offset = offset; +} + struct bvec_iter { sector_t bi_sector; /* device address in 512 byte sectors */ |