]> Pileus Git - ~andy/linux/commitdiff
GFS2: No need to invalidate pages for a dio read
authorSteven Whitehouse <swhiteho@redhat.com>
Tue, 14 Jan 2014 13:46:51 +0000 (13:46 +0000)
committerSteven Whitehouse <swhiteho@redhat.com>
Tue, 14 Jan 2014 19:20:49 +0000 (19:20 +0000)
We recently fixed the writeback of pages prior to performing
direct i/o, however the initial fix was perhaps a bit heavy
handed. There is no need to invalidate pages if the direct i/o
is only a read, since they will be identical to what has been
flushed to disk anyway.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/aops.c

index cf858dad75d9a6d3580a486d56c0f46f55146336..49436fa7cd4fdcf87fb9f9dae13743173df2ab52 100644 (file)
@@ -1032,8 +1032,9 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
                        unmap_shared_mapping_range(ip->i_inode.i_mapping, offset, len);
                rv = filemap_write_and_wait_range(mapping, lstart, end);
                if (rv)
-                       return rv;
-               truncate_inode_pages_range(mapping, lstart, end);
+                       goto out;
+               if (rw == WRITE)
+                       truncate_inode_pages_range(mapping, lstart, end);
        }
 
        rv = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,