aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiquel van Smoorenburg <mikevs@xs4all.net>2009-01-06 17:39:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:58:59 -0500
commit38c8e6180939e5619140b2e9e479cb26029ff8b1 (patch)
tree1980f3dadfa02ac6c1fc2ad7236205af54f7972a
parent75aa199410359dc5fbcf9025ff7af98a9d20f0d5 (diff)
do_mpage_readpage(): don't submit lots of small bios on boundary
While tracing I/O patterns with blktrace (a great tool) a few weeks ago I identified a minor issue in fs/mpage.c As the comment above mpage_readpages() says, a fs's get_block function will set BH_Boundary when it maps a block just before a block for which extra I/O is required. Since get_block() can map a range of pages, for all these pages the BH_Boundary flag will be set. But we only need to push what I/O we have accumulated at the last block of this range. This makes do_mpage_readpage() send out the largest possible bio instead of a bunch of page-sized ones in the BH_Boundary case. Signed-off-by: Miquel van Smoorenburg <mikevs@xs4all.net> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/mpage.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/mpage.c b/fs/mpage.c
index 552b80b3facc..46e977efd50a 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -308,7 +308,10 @@ alloc_new:
308 goto alloc_new; 308 goto alloc_new;
309 } 309 }
310 310
311 if (buffer_boundary(map_bh) || (first_hole != blocks_per_page)) 311 relative_block = block_in_file - *first_logical_block;
312 nblocks = map_bh->b_size >> blkbits;
313 if ((buffer_boundary(map_bh) && relative_block == nblocks) ||
314 (first_hole != blocks_per_page))
312 bio = mpage_bio_submit(READ, bio); 315 bio = mpage_bio_submit(READ, bio);
313 else 316 else
314 *last_block_in_bio = blocks[blocks_per_page - 1]; 317 *last_block_in_bio = blocks[blocks_per_page - 1];