[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230503102542epcms2p371143d5975c9fa4e4a081b96f6bfc2c0@epcms2p3>
Date: Wed, 03 May 2023 19:25:42 +0900
From: Jinyoung CHOI <j-young.choi@...sung.com>
To: Jinyoung CHOI <j-young.choi@...sung.com>,
"axboe@...nel.dk" <axboe@...nel.dk>, "hch@....de" <hch@....de>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"kch@...dia.com" <kch@...dia.com>,
"johannes.thumshirn@....com" <johannes.thumshirn@....com>,
"willy@...radead.org" <willy@...radead.org>,
"linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 13/15] block: add helper function for iteration of bip's
bvec
bip_for_each_vec() performs the iteration in a page unit.
Since a bio_vec of bip is composed of multi-page in the block, a macro
that can be carried out in multi-page units has been added.
Cc: Christoph Hellwig <hch@....de>
Cc: Martin K. Petersen <martin.petersen@...cle.com>
Signed-off-by: Jinyoung Choi <j-young.choi@...sung.com>
---
include/linux/bio.h | 4 ++++
include/linux/bvec.h | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b53a595b519a..e3e437ce694c 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -695,6 +695,10 @@ static inline bool bioset_initialized(struct bio_set *bs)
#if defined(CONFIG_BLK_DEV_INTEGRITY)
+/* iterate over multi-page bvec for integrity */
+#define bip_for_each_mp_bvec(bvl, bip, iter) \
+ for_each_mp_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter)
+
#define bip_for_each_vec(bvl, bip, iter) \
for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter)
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 555aae5448ae..9364c258513e 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -184,6 +184,12 @@ static inline void bvec_iter_advance_single(const struct bio_vec *bv,
((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \
bvec_iter_advance_single((bio_vec), &(iter), (bvl).bv_len))
+#define for_each_mp_bvec(bvl, bio_vec, iter, start) \
+ for (iter = (start); \
+ (iter).bi_size && \
+ ((bvl = mp_bvec_iter_bvec((bio_vec), (iter))), 1); \
+ bvec_iter_advance_single((bio_vec), &(iter), (bvl).bv_len))
+
/* for iterating one bio from start to end */
#define BVEC_ITER_ALL_INIT (struct bvec_iter) \
{ \
--
2.34.1
Powered by blists - more mailing lists