diff mbox

ext4: clean up the flags passed to __blockdev_direct_IO for extent-based files

Message ID x49zkc7c36m.fsf@segfault.boston.devel.redhat.com
State Accepted, archived
Headers show

Commit Message

Jeff Moyer Feb. 24, 2012, 9:49 p.m. UTC
Hi,

For extent-based files, you can perform DIO to holes, as mentioned in
the comments in ext4_ext_direct_IO.  However, that function passes
DIO_SKIP_HOLES to __blockdev_direct_IO, which is *really* confusing to
the uninitiated reader.  The key, here, is that the get_block function
passed in, ext4_get_block_write, completely ignores the create flag that
is passed to it (the create flag is passed in from the direct I/O code,
which uses the DIO_SKIP_HOLES flag to determine whether or not it should
be cleared).

This is a long-winded way of saying that the DIO_SKIP_HOLES flag is
ultimately ignored.  So, in the interest of preserving sanity, I propose
the following patch.

Cheers,
Jeff

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eric Sandeen Feb. 24, 2012, 9:52 p.m. UTC | #1
On 2/24/12 3:49 PM, Jeff Moyer wrote:
> Hi,
> 
> For extent-based files, you can perform DIO to holes, as mentioned in
> the comments in ext4_ext_direct_IO.  However, that function passes
> DIO_SKIP_HOLES to __blockdev_direct_IO, which is *really* confusing to
> the uninitiated reader.  The key, here, is that the get_block function
> passed in, ext4_get_block_write, completely ignores the create flag that
> is passed to it (the create flag is passed in from the direct I/O code,
> which uses the DIO_SKIP_HOLES flag to determine whether or not it should
> be cleared).
> 
> This is a long-winded way of saying that the DIO_SKIP_HOLES flag is
> ultimately ignored.  So, in the interest of preserving sanity, I propose
> the following patch.
> 
> Cheers,
> Jeff
> 
> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

Thank you sir.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index feaa82f..521ca03 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -2940,7 +2940,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
>  					 ext4_get_block_write,
>  					 ext4_end_io_dio,
>  					 NULL,
> -					 DIO_LOCKING | DIO_SKIP_HOLES);
> +					 DIO_LOCKING);
>  		if (iocb->private)
>  			EXT4_I(inode)->cur_aio_dio = NULL;
>  		/*
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o March 5, 2012, 3:25 p.m. UTC | #2
On Fri, Feb 24, 2012 at 04:49:21PM -0500, Jeff Moyer wrote:
> Hi,
> 
> For extent-based files, you can perform DIO to holes, as mentioned in
> the comments in ext4_ext_direct_IO.  However, that function passes
> DIO_SKIP_HOLES to __blockdev_direct_IO, which is *really* confusing to
> the uninitiated reader.  The key, here, is that the get_block function
> passed in, ext4_get_block_write, completely ignores the create flag that
> is passed to it (the create flag is passed in from the direct I/O code,
> which uses the DIO_SKIP_HOLES flag to determine whether or not it should
> be cleared).
> 
> This is a long-winded way of saying that the DIO_SKIP_HOLES flag is
> ultimately ignored.  So, in the interest of preserving sanity, I propose
> the following patch.
> 
> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index feaa82f..521ca03 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2940,7 +2940,7 @@  static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
 					 ext4_get_block_write,
 					 ext4_end_io_dio,
 					 NULL,
-					 DIO_LOCKING | DIO_SKIP_HOLES);
+					 DIO_LOCKING);
 		if (iocb->private)
 			EXT4_I(inode)->cur_aio_dio = NULL;
 		/*