diff mbox series

[02/23] block: add a bvec_set_folio helper

Message ID 20230130092157.1759539-3-hch@lst.de (mailing list archive)
State New
Headers show
Series [01/23] block: factor out a bvec_set_page helper | expand

Commit Message

Christoph Hellwig Jan. 30, 2023, 9:21 a.m. UTC
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>
---
 include/linux/bvec.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Johannes Thumshirn Jan. 30, 2023, 11:54 a.m. UTC | #1
On 30.01.23 10:24, Christoph Hellwig wrote:

> +/**
> + * bvec_set_folio - initialize a bvec based off a struct folio
> + * @bv:		bvec to initialize
> + * @page:	folio the bvec should point to

s/page/folio

> + * @len:	length of the bvec
> + * @offset:	offset into the folio
> + */

Otherwise,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Chaitanya Kulkarni Jan. 31, 2023, 6:55 a.m. UTC | #2
On 1/30/23 01:21, Christoph Hellwig wrote:
> 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>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
diff mbox series

Patch

diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 9e3dac51eb26b6..f094512ce3bda9 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -50,6 +50,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
+ * @page:	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 */