mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] block: fix bio_add_page for non trivial merge_bvec_fn case(v2)
@ 2008-07-05 14:16 Dmitri Monakhov
  0 siblings, 0 replies; only message in thread
From: Dmitri Monakhov @ 2008-07-05 14:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jens Axboe, Alasdair G Kergon

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.

Changes against v1:
 According to axboe@ and agk@ we don't have to decrease bi_vcnt and segments
 counters, so patch now looks like one line fix.

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

diff --git a/fs/bio.c b/fs/bio.c
index 25f1af0..0e6ed2a 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -330,7 +330,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.5.4.rc4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-05 14:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-05 14:16 [PATCH] block: fix bio_add_page for non trivial merge_bvec_fn case(v2) Dmitri Monakhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®