Commit 666e6550 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: add a bvec_set_virt helper

A small wrapper around bvec_set_page for callers that have a virtual
address.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20230203150634.3199647-4-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 26db5ee1
......@@ -62,6 +62,18 @@ static inline void bvec_set_folio(struct bio_vec *bv, struct folio *folio,
bvec_set_page(bv, &folio->page, len, offset);
}
/**
* bvec_set_virt - initialize a bvec based on a virtual address
* @bv: bvec to initialize
* @vaddr: virtual address to set the bvec to
* @len: length of the bvec
*/
static inline void bvec_set_virt(struct bio_vec *bv, void *vaddr,
unsigned int len)
{
bvec_set_page(bv, virt_to_page(vaddr), len, offset_in_page(vaddr));
}
struct bvec_iter {
sector_t bi_sector; /* device address in 512 byte
sectors */
......
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