diff options
Diffstat (limited to 'include/linux/bio.h')
-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 | ||