diff options
author | Christoph Hellwig <hch@lst.de> | 2023-02-03 18:06:14 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-02-03 18:20:55 +0300 |
commit | 666e6550cb74e3a7206b5699409c9f31e123887e (patch) | |
tree | 3a34ed77e6668f452b152b21cebdc6c1c6e487ab /include/linux | |
parent | 26db5ee158510108c819aa7be6eb8c75accf85d7 (diff) | |
download | linux-666e6550cb74e3a7206b5699409c9f31e123887e.tar.xz |
block: add a bvec_set_virt helper
A small wrapper around bvec_set_page for callers that have a virtual
address.
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-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bvec.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/bvec.h b/include/linux/bvec.h index b9e64b91e92b..555aae5448ae 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -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 */ |