diff options
Diffstat (limited to 'fs/bio.c')
-rw-r--r-- | fs/bio.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -78,7 +78,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) | |||
78 | 78 | ||
79 | i = 0; | 79 | i = 0; |
80 | while (i < bio_slab_nr) { | 80 | while (i < bio_slab_nr) { |
81 | struct bio_slab *bslab = &bio_slabs[i]; | 81 | bslab = &bio_slabs[i]; |
82 | 82 | ||
83 | if (!bslab->slab && entry == -1) | 83 | if (!bslab->slab && entry == -1) |
84 | entry = i; | 84 | entry = i; |
@@ -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 | ||