Thread (76 messages) 76 messages, 6 authors, 2017-10-19
STALE3179d
Revisions (6)
  1. v2 [diff vs current]
  2. v3 current
  3. v4 [diff vs current]
  4. v5 [diff vs current]
  5. v5 [diff vs current]
  6. v6 [diff vs current]

[PATCH v3 28/49] block: introduce bvec_get_last_page()

From: Ming Lei <hidden>
Date: 2017-08-08 08:45:27
Also in: linux-fsdevel, linux-mm, lkml
Subsystem: the rest · Maintainer: Linus Torvalds

BTRFS and guard_bio_eod() need to get the last page, so introduce
this helper to make them happy.

Signed-off-by: Ming Lei <redacted>
---
 include/linux/bvec.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 23d3abdf057c..ceb6292750d6 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -238,4 +238,18 @@ static inline bool bvec_iter_advance_mp(const struct bio_vec *bv,
 #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)
 
+/*
+ * get the last page from the multipage bvec and store it
+ * in @sp_bv
+ */
+static inline void bvec_get_last_page(struct bio_vec *mp_bv,
+				      struct bio_vec *sp_bv)
+{
+	struct bvec_iter iter;
+
+	*sp_bv = *mp_bv;
+	bvec_for_each_sp_bvec(*sp_bv, mp_bv, iter)
+		;
+}
+
 #endif /* __LINUX_BVEC_ITER_H */
-- 
2.9.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help