aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2014-06-01 17:21:13 -0700
committerAndreas Blaesius <skate4life@gmx.de>2016-06-05 21:21:26 +0200
commitf88695ea6bfcd91c7734b083505a640bd2b551ba (patch)
tree872be49a6469da6ecdc0291babd1687b33249810 /include
parentbb25711744c7c3086389c780a5ebfd147f9f6cce (diff)
downloadkernel_samsung_espresso10-f88695ea6bfcd91c7734b083505a640bd2b551ba.zip
kernel_samsung_espresso10-f88695ea6bfcd91c7734b083505a640bd2b551ba.tar.gz
kernel_samsung_espresso10-f88695ea6bfcd91c7734b083505a640bd2b551ba.tar.bz2
block: Add bio_for_each_segment_all()
__bio_for_each_segment() iterates bvecs from the specified index instead of bio->bv_idx. Currently, the only usage is to walk all the bvecs after the bio has been advanced by specifying 0 index. For immutable bvecs, we need to split these apart; bio_for_each_segment() is going to have a different implementation. This will also help document the intent of code that's using it - bio_for_each_segment_all() is only legal to use for code that owns the bio. [patch reduced to just include/linux/bio change] Change-Id: Ia2f23d32db6149223beda41bfe7956bb73e1c1dc
Diffstat (limited to 'include')
-rw-r--r--include/linux/bio.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index ce33e68..da350c4 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -143,6 +143,15 @@ static inline int bio_has_allocated_vec(struct bio *bio)
i < (bio)->bi_vcnt; \
bvl++, i++)
+/*
+ * drivers should _never_ use the all version - the bio may have been split
+ * before it got to the driver and the driver won't own all of it
+ */
+#define bio_for_each_segment_all(bvl, bio, i) \
+ for (i = 0; \
+ bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \
+ i++)
+
#define bio_for_each_segment(bvl, bio, i) \
__bio_for_each_segment(bvl, bio, i, (bio)->bi_idx)