Commit 854e7031 authored by Badari Pulavarty's avatar Badari Pulavarty Committed by Linus Torvalds

[PATCH] dio fine alignment and pages in io

Here is the fix for dio_new_bio() BUG() with fsx tests.  The problem is, I
changed dio_pages_in_io calculation to be exactly the number of pages we
needed to map the user-buffer to do the IO.  But with fine-grain alignment
(non fs-blocksize), we may need 2 more pages (ZERO_PAGE) to zero out first
and last block if needed.

Here is the bug info.

http://bugme.osdl.org/show_bug.cgi?id=3447Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4e189559
......@@ -958,7 +958,15 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
dio->bio_list = NULL;
dio->waiter = NULL;
dio->pages_in_io = 0;
/*
* In case of non-aligned buffers, we may need 2 more
* pages since we need to zero out first and last block.
*/
if (unlikely(dio->blkfactor))
dio->pages_in_io = 2;
else
dio->pages_in_io = 0;
for (seg = 0; seg < nr_segs; seg++) {
user_addr = (unsigned long)iov[seg].iov_base;
dio->pages_in_io +=
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment