When the current bvec can be merged to the 1st segment, the bio's front segment size has to be updated. However, dcebd755926b doesn't consider that case, then bio's front segment size may not be correct. This patch fixes this issue.
Unified · Split
| @@ -277,6 +277,9 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, · 276 unmodified lines | ||
| 277 | 277 | bvprvp = &bvprv; |
| 278 | 278 | sectors += bv.bv_len >> 9; |
| 279 | 279 | |
| 280 | + if (nsegs == 1 && seg_size > front_seg_size) | |
| 281 | + front_seg_size = seg_size; | |
| 282 | + | |
| 280 | 283 | continue; |
| 281 | 284 | } |
| 282 | 285 | new_segment: |
| @@ -401,6 +404,11 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q, · 118 unmodified lines | ||
| 401 | 404 | |
| 402 | 405 | seg_size += bv.bv_len; |
| 403 | 406 | bvprv = bv; |
| 407 | + | |
| 408 | + if (nr_phys_segs == 1 && seg_size > | |
| 409 | + front_seg_size) | |
| 410 | + front_seg_size = seg_size; | |
| 411 | + | |
| 404 | 412 | continue; |
| 405 | 413 | } |
| 406 | 414 | new_segment: |