diff options
author | Kent Overstreet <kmo@daterainc.com> | 2014-02-10 20:45:50 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-02-11 10:40:45 -0500 |
commit | 8423ae3d7a3cfe084865262cfaeba1359d405182 (patch) | |
tree | e8e6f9c31f5622e66ff176b600cf3b3c951eb4d8 /include/linux | |
parent | 9d4cb8e3a5b448d802155688bf2d50ac1b9e1a51 (diff) |
block: Fix cloning of discard/write same bios
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>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bio.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index d6791bba8264..5a4d39b4686b 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -250,6 +250,17 @@ static inline unsigned bio_segments(struct bio *bio) | |||
250 | struct bio_vec bv; | 250 | struct bio_vec bv; |
251 | struct bvec_iter iter; | 251 | struct bvec_iter iter; |
252 | 252 | ||
253 | /* | ||
254 | * We special case discard/write same, because they interpret bi_size | ||
255 | * differently: | ||
256 | */ | ||
257 | |||
258 | if (bio->bi_rw & REQ_DISCARD) | ||
259 | return 1; | ||
260 | |||
261 | if (bio->bi_rw & REQ_WRITE_SAME) | ||
262 | return 1; | ||
263 | |||
253 | bio_for_each_segment(bv, bio, iter) | 264 | bio_for_each_segment(bv, bio, iter) |
254 | segs++; | 265 | segs++; |
255 | 266 | ||