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


Groups > linux.kernel > #1674657 > unrolled thread

[PATCH v2 30/51] block: introduce bvec_get_last_page()

Started byMing Lei <ming.lei@redhat.com>
First post2017-06-26 14:20 +0200
Last post2017-06-26 14:20 +0200
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 v2 30/51] block: introduce bvec_get_last_page() Ming Lei <ming.lei@redhat.com> - 2017-06-26 14:20 +0200

#1674657 — [PATCH v2 30/51] block: introduce bvec_get_last_page()

FromMing Lei <ming.lei@redhat.com>
Date2017-06-26 14:20 +0200
Subject[PATCH v2 30/51] block: introduce bvec_get_last_page()
Message-ID<tWB9L-2fr-1@gated-at.bofh.it>
BTRFS and guard_bio_eod() need to get the last page, so introduce
this helper to make them happy.

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

diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 7addceea9828..6673e3c0b7eb 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -206,4 +206,18 @@ static inline void 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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web