From: Jan Kara Date: Wed, 20 Mar 2013 04:07:09 +0000 (+1100) Subject: direct-io: Fix boundary block handling X-Git-Tag: next-20130321~2^2~382 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4e9dc69ce74add551923fc420c2fb97f27ca302a;p=karo-tx-linux.git 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. Signed-off-by: Jan Kara Reported-by: Kazuya Mio Signed-off-by: Andrew Morton --- 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: this_chunk_bytes = this_chunk_blocks << blkbits; BUG_ON(this_chunk_bytes == 0); - sdio->boundary = buffer_boundary(map_bh); + if (this_chunk_blocks == sdio->blocks_available) + sdio->boundary = buffer_boundary(map_bh); ret = submit_page_section(dio, sdio, page, offset_in_page, this_chunk_bytes,