]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] revert the "dio handle eof" fix
authorAndrew Morton <akpm@osdl.org>
Thu, 2 Dec 2004 23:43:27 +0000 (15:43 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 2 Dec 2004 23:43:27 +0000 (15:43 -0800)
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: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/direct-io.c

index 0eb122c56320904ddc7b3d0f2520c00bece10807..4cbcff38e014befb1ef7dd3bbed615f9d644f8b7 100644 (file)
@@ -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);