summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-02-03 16:06:13 +0100
committerJens Axboe <axboe@kernel.dk>2023-02-03 08:20:55 -0700
commit26db5ee158510108c819aa7be6eb8c75accf85d7 (patch)
tree0f645f5eecad412ea2e26aa63d8b6a8bc18d56ee
parentd58cdfae6a22e5079656c487aad669597a0635c8 (diff)
downloadlwn-26db5ee158510108c819aa7be6eb8c75accf85d7.tar.gz
lwn-26db5ee158510108c819aa7be6eb8c75accf85d7.zip
block: add a bvec_set_folio helper
A smaller wrapper around bvec_set_page that takes a folio instead. There are only two potential users for this in the tree, but the number will grow in the future. 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-3-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--include/linux/bvec.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index a7b7c016b9a3..b9e64b91e92b 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -49,6 +49,19 @@ static inline void bvec_set_page(struct bio_vec *bv, struct page *page,
bv->bv_offset = offset;
}
+/**
+ * bvec_set_folio - initialize a bvec based off a struct folio
+ * @bv: bvec to initialize
+ * @folio: folio the bvec should point to
+ * @len: length of the bvec
+ * @offset: offset into the folio
+ */
+static inline void bvec_set_folio(struct bio_vec *bv, struct folio *folio,
+ unsigned int len, unsigned int offset)
+{
+ bvec_set_page(bv, &folio->page, len, offset);
+}
+
struct bvec_iter {
sector_t bi_sector; /* device address in 512 byte
sectors */