Commit 01a59cd1 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] revert the "dio handle eof" fix

This recent fix isn't quite right: it is causing smaller-than-expected I/Os to
be submitted when extending files, which causes AIO-based writes to oops.

So just revert it - the bug was really over in blockdev_get_blocks() anyway.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 52b787ee
......@@ -928,8 +928,6 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
ssize_t ret = 0;
ssize_t ret2;
size_t bytes;
size_t bytes_todo;
loff_t isize;
dio->bio = NULL;
dio->inode = inode;
......@@ -977,32 +975,16 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
else
dio->pages_in_io = 0;
bytes_todo = 0;
for (seg = 0; seg < nr_segs; seg++) {
user_addr = (unsigned long)iov[seg].iov_base;
dio->pages_in_io +=
((user_addr+iov[seg].iov_len +PAGE_SIZE-1)/PAGE_SIZE
- user_addr/PAGE_SIZE);
bytes_todo += iov[seg].iov_len;
}
isize = i_size_read(inode);
if (bytes_todo > (isize - offset)) {
if ((isize - offset))
bytes_todo = isize - offset;
else if (bytes_todo > PAGE_SIZE)
bytes_todo = PAGE_SIZE;
}
for (seg = 0; seg < nr_segs && bytes_todo; seg++) {
size_t bytes_done;
for (seg = 0; seg < nr_segs; seg++) {
user_addr = (unsigned long)iov[seg].iov_base;
bytes = iov[seg].iov_len;
if (bytes > bytes_todo)
bytes = bytes_todo;
bytes_todo -= bytes;
dio->size += bytes;
dio->size += bytes = iov[seg].iov_len;
/* Index into the first page of the first block */
dio->first_block_in_page = (user_addr & ~PAGE_MASK) >> blkbits;
......@@ -1014,19 +996,16 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
dio->curr_page = 0;
dio->total_pages = 0;
bytes_done = bytes;
if (user_addr & (PAGE_SIZE-1)) {
dio->total_pages++;
bytes_done = bytes;
bytes -= PAGE_SIZE - (user_addr & (PAGE_SIZE - 1));
}
dio->total_pages += (bytes + PAGE_SIZE - 1) / PAGE_SIZE;
dio->curr_user_address = user_addr;
ret = do_direct_IO(dio);
dio->result += bytes_done -
dio->result += iov[seg].iov_len -
((dio->final_block_in_request - dio->block_in_file) <<
blkbits);
......
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