Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1547668 > unrolled thread

[PATCH v1 29/54] block: introduce bvec_for_each_sp_bvec()

Started byMing Lei <tom.leiming@gmail.com>
First post2016-12-27 17:20 +0100
Last post2016-12-27 17:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v1 29/54] block: introduce bvec_for_each_sp_bvec() Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:20 +0100

#1547668 — [PATCH v1 29/54] block: introduce bvec_for_each_sp_bvec()

FromMing Lei <tom.leiming@gmail.com>
Date2016-12-27 17:20 +0100
Subject[PATCH v1 29/54] block: introduce bvec_for_each_sp_bvec()
Message-ID<sT2DM-4jR-5@gated-at.bofh.it>
This helper can be used to iterate each singlepage bvec
from one multipage bvec.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 include/linux/bvec.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 5c51c58fe202..baf379d56106 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -192,4 +192,18 @@ static inline void bvec_iter_advance_mp(const struct bio_vec *bv,
 	.bi_bvec_done	= 0,						\
 }
 
+/*
+ * This helper iterates over the multipage bvec of @mp_bvec and
+ * returns each singlepage bvec via @sp_bvl.
+ */
+#define __bvec_for_each_sp_bvec(sp_bvl, mp_bvec, iter, start)		\
+	for (iter = start,						\
+	     (iter).bi_size = (mp_bvec)->bv_len;			\
+	     (iter).bi_size &&						\
+		((sp_bvl = bvec_iter_bvec((mp_bvec), (iter))), 1);	\
+	     bvec_iter_advance((mp_bvec), &(iter), (sp_bvl).bv_len))
+
+#define bvec_for_each_sp_bvec(sp_bvl, mp_bvec, iter)			\
+	__bvec_for_each_sp_bvec(sp_bvl, mp_bvec, iter, BVEC_ITER_ALL_INIT)
+
 #endif /* __LINUX_BVEC_ITER_H */
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web