2010-01-12 19:43:12

by Jiaying Zhang

[permalink] [raw]
Subject: [PATCHv2 2/3] ext4: use direct_IO_no_locking in ext4 DIO read

ext4: Use direct_IO_no_locking in ext4 dio read.

Signed-off-by: Jiaying Zhang <[email protected]>

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9ee3550..44d2e19 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3395,7 +3395,15 @@ 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 && test_opt(inode->i_sb, DIOREAD_NOLOCK)
+ && (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
+ 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))


2010-01-12 19:49:46

by Jiaying Zhang

[permalink] [raw]
Subject: Re: [PATCHv2 2/3] ext4: use direct_IO_no_locking in ext4 DIO read

Oops, this should be [PATCHv2 3/3].

Jiaying

On Tue, Jan 12, 2010 at 11:42 AM, Jiaying Zhang <[email protected]> wrote:
>
> ? ?ext4: Use direct_IO_no_locking in ext4 dio read.
>
> ? ?Signed-off-by: Jiaying Zhang <[email protected]>
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 9ee3550..44d2e19 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3395,7 +3395,15 @@ 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 && test_opt(inode->i_sb, DIOREAD_NOLOCK)
> + ? ? ? ? ? ? ? ? ? ? ? && (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
> + ? ? ? ? ? ? ? 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))