[PATCH] [PATCH] block: fix bio_add_page for non trivial merge_bvec_fn case

From: Dmitry Monakhov
Date: Tue Jan 26 2010 - 08:01:34 EST


We have to properly decrease bi_size in order to merge_bvec_fn return
right result. Otherwise this result in false merge rejects for two
absolutely valid bio_vecs. This may cause significant performance penalty
for example Itanium: page_size == 16k, fs_block_size == 1k and block device
is raid with small chunk_size.

Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
---
fs/bio.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index 76e6713..9f8e517 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -548,7 +548,8 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
struct bvec_merge_data bvm = {
.bi_bdev = bio->bi_bdev,
.bi_sector = bio->bi_sector,
- .bi_size = bio->bi_size,
+ .bi_size = bio->bi_size -
+ (prev->bv_len - len),
.bi_rw = bio->bi_rw,
};

--
1.6.3.3


--=-=-=--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/