aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/bio.h
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2020-04-16 14:46:11 -0700
committerDavid Sterba <dsterba@suse.com>2020-05-25 11:25:24 +0200
commit1072c12d7d58b5512b6c05c2268f57d32f1ab76c (patch)
tree45deabef6738854caebcdada4773a68c3bae35b6 /include/linux/bio.h
parentbtrfs: simplify error handling of clean_pinned_extents() (diff)
downloadwireguard-linux-1072c12d7d58b5512b6c05c2268f57d32f1ab76c.tar.xz
wireguard-linux-1072c12d7d58b5512b6c05c2268f57d32f1ab76c.zip
block: add bio_for_each_bvec_all()
An upcoming Btrfs fix needs to know the original size of a non-cloned bios. Rather than accessing the bvec table directly, let's add a bio_for_each_bvec_all() accessor. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r--include/linux/bio.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index a0ee494a6329..8e23f51ccfa4 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -169,6 +169,14 @@ static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter,
#define bio_for_each_bvec(bvl, bio, iter) \
__bio_for_each_bvec(bvl, bio, iter, (bio)->bi_iter)
+/*
+ * Iterate over all multi-page bvecs. Drivers shouldn't use this version for the
+ * same reasons as bio_for_each_segment_all().
+ */
+#define bio_for_each_bvec_all(bvl, bio, i) \
+ for (i = 0, bvl = bio_first_bvec_all(bio); \
+ i < (bio)->bi_vcnt; i++, bvl++) \
+
#define bio_iter_last(bvec, iter) ((iter).bi_size == (bvec).bv_len)
static inline unsigned bio_segments(struct bio *bio)