aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-04-29 18:06:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:54:28 -0400
commit092c8d46e348b5fa4109a06d8a1246060e09dc8c (patch)
tree2ef07a88ae3ed7638712a2fbcb9eb19ba0ece147 /fs
parente05c4bbfaedb7585a5b7936b3b84e68928c6474f (diff)
direct-io: fix boundary block handling
When we read/write a file sequentially, we will read/write not only the data blocks but also the indirect blocks that may not be physically adjacent to the data blocks. So filesystems set the BH_Boundary flag to submit the previous I/O before reading/writing an indirect block. However the generic direct IO code mishandles buffer_boundary(), setting sdio->boundary before each submit_page_section() call which results in sending only one page bios as underlying code thinks this page is the last in the contiguous extent. So fix the problem by setting sdio->boundary only if the current page is really the last one in the mapped extent. With this patch and "direct-io: submit bio after boundary buffer is added to it" I've measured about 10% throughput improvement of direct IO reads on ext3 with SATA harddrive (from 90 MB/s to 100 MB/s). With ramdisk, the improvement was about 3-fold (from 350 MB/s to 1.2 GB/s). For other filesystems (such as ext4), the improvements won't be as visible because the frequency of BH_Boundary flag being set is much smaller. Signed-off-by: Jan Kara <jack@suse.cz> Reported-by: Kazuya Mio <k-mio@sx.jp.nec.com> Tested-by: Kazuya Mio <k-mio@sx.jp.nec.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/direct-io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index f853263cf74f..9644d0205dad 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -969,7 +969,8 @@ do_holes:
969 this_chunk_bytes = this_chunk_blocks << blkbits; 969 this_chunk_bytes = this_chunk_blocks << blkbits;
970 BUG_ON(this_chunk_bytes == 0); 970 BUG_ON(this_chunk_bytes == 0);
971 971
972 sdio->boundary = buffer_boundary(map_bh); 972 if (this_chunk_blocks == sdio->blocks_available)
973 sdio->boundary = buffer_boundary(map_bh);
973 ret = submit_page_section(dio, sdio, page, 974 ret = submit_page_section(dio, sdio, page,
974 offset_in_page, 975 offset_in_page,
975 this_chunk_bytes, 976 this_chunk_bytes,