ext4: Use direct_IO_no_locking in ext4 dio read
authorJiaying Zhang <jiayingz@google.com>
Tue, 2 Mar 2010 18:26:36 +0000 (13:26 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 2 Mar 2010 18:26:36 +0000 (13:26 -0500)
Signed-off-by: Jiaying Zhang <jiayingz@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/inode.c

index d291310aef6b059ae6ea2c830d5c4bcfd676e7e7..92214d4e5afad00425e8c6b6cadda70651cf3d6f 100644 (file)
@@ -3474,7 +3474,14 @@ static ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb,
        }
 
 retry:
-       ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
+       if (rw == READ && ext4_should_dioread_nolock(inode))
+               ret = blockdev_direct_IO_no_locking(rw, iocb, inode,
+                                inode->i_sb->s_bdev, iov,
+                                offset, nr_segs,
+                                ext4_get_block, NULL);
+       else
+               ret = blockdev_direct_IO(rw, iocb, inode,
+                                inode->i_sb->s_bdev, iov,
                                 offset, nr_segs,
                                 ext4_get_block, NULL);
        if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))