summaryrefslogtreecommitdiff
path: root/include/linux/bio.h
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2014-02-10 17:37:40 -0800
committerKent Overstreet <kmo@daterainc.com>2014-02-10 17:37:57 -0800
commitfb5ece9efcfe77e32366fee18dcbf7ba7698a148 (patch)
tree8626f71517ec45fbbd584b7c06be63df165b18b9 /include/linux/bio.h
parent0606b6103d636b779795d8043837a8f8e1560cdd (diff)
block: Fix cloning of discard/write same biosblock_discard_fix
Immutable biovecs changed the way bio segments are treated in such a way that bio_for_each_segment() cannot now do what we want for discard/write same bios, since bi_size means something completely different for them. Fortunately discard and write same bios never have more than a single biovec, so bio_for_each_segment() is unnecessary and not terribly meaningful for them, but we still have to special case them in a few places. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r--include/linux/bio.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 70654521dab6..05d2a0392f31 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -250,6 +250,17 @@ static inline unsigned bio_segments(struct bio *bio)
struct bio_vec bv;
struct bvec_iter iter;
+ /*
+ * We special case discard/write same, because they interpret bi_size
+ * differently:
+ */
+
+ if (bio->bi_rw & REQ_DISCARD)
+ return 1;
+
+ if (bio->bi_rw & REQ_WRITE_SAME)
+ return 1;
+
bio_for_each_segment(bv, bio, iter)
segs++;