]> Pileus Git - ~andy/linux/blobdiff - mm/filemap.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[~andy/linux] / mm / filemap.c
index 7a7f3e0db7384515b6e266029ef930e5c775ec0d..d56d3c145b9f26d3210ec8ad17430be6c46af2a9 100644 (file)
@@ -1428,30 +1428,28 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
                if (!count)
                        goto out; /* skip atime */
                size = i_size_read(inode);
-               if (pos < size) {
-                       retval = filemap_write_and_wait_range(mapping, pos,
+               retval = filemap_write_and_wait_range(mapping, pos,
                                        pos + iov_length(iov, nr_segs) - 1);
-                       if (!retval) {
-                               retval = mapping->a_ops->direct_IO(READ, iocb,
-                                                       iov, pos, nr_segs);
-                       }
-                       if (retval > 0) {
-                               *ppos = pos + retval;
-                               count -= retval;
-                       }
+               if (!retval) {
+                       retval = mapping->a_ops->direct_IO(READ, iocb,
+                                                          iov, pos, nr_segs);
+               }
+               if (retval > 0) {
+                       *ppos = pos + retval;
+                       count -= retval;
+               }
 
-                       /*
-                        * Btrfs can have a short DIO read if we encounter
-                        * compressed extents, so if there was an error, or if
-                        * we've already read everything we wanted to, or if
-                        * there was a short read because we hit EOF, go ahead
-                        * and return.  Otherwise fallthrough to buffered io for
-                        * the rest of the read.
-                        */
-                       if (retval < 0 || !count || *ppos >= size) {
-                               file_accessed(filp);
-                               goto out;
-                       }
+               /*
+                * Btrfs can have a short DIO read if we encounter
+                * compressed extents, so if there was an error, or if
+                * we've already read everything we wanted to, or if
+                * there was a short read because we hit EOF, go ahead
+                * and return.  Otherwise fallthrough to buffered io for
+                * the rest of the read.
+                */
+               if (retval < 0 || !count || *ppos >= size) {
+                       file_accessed(filp);
+                       goto out;
                }
        }