diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -542,13 +542,18 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page | |||
542 | 542 | ||
543 | if (page == prev->bv_page && | 543 | if (page == prev->bv_page && |
544 | offset == prev->bv_offset + prev->bv_len) { | 544 | offset == prev->bv_offset + prev->bv_len) { |
545 | unsigned int prev_bv_len = prev->bv_len; | ||
545 | prev->bv_len += len; | 546 | prev->bv_len += len; |
546 | 547 | ||
547 | if (q->merge_bvec_fn) { | 548 | if (q->merge_bvec_fn) { |
548 | struct bvec_merge_data bvm = { | 549 | struct bvec_merge_data bvm = { |
550 | /* prev_bvec is already charged in | ||
551 | bi_size, discharge it in order to | ||
552 | simulate merging updated prev_bvec | ||
553 | as new bvec. */ | ||
549 | .bi_bdev = bio->bi_bdev, | 554 | .bi_bdev = bio->bi_bdev, |
550 | .bi_sector = bio->bi_sector, | 555 | .bi_sector = bio->bi_sector, |
551 | .bi_size = bio->bi_size, | 556 | .bi_size = bio->bi_size - prev_bv_len, |
552 | .bi_rw = bio->bi_rw, | 557 | .bi_rw = bio->bi_rw, |
553 | }; | 558 | }; |
554 | 559 | ||