2020-07-21 18:33:24

by Christoph Hellwig

[permalink] [raw]
Subject: [PATCH 1/3] xfs: use ENOTBLK for direct I/O to buffered I/O fallback

This is what the classic fs/direct-io.c implementation and thuse other
file systems use.

Signed-off-by: Christoph Hellwig <[email protected]>
---
fs/xfs/xfs_file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 00db81eac80d6c..a6ef90457abf97 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -505,7 +505,7 @@ xfs_file_dio_aio_write(
*/
if (xfs_is_cow_inode(ip)) {
trace_xfs_reflink_bounce_dio_write(ip, iocb->ki_pos, count);
- return -EREMCHG;
+ return -ENOTBLK;
}
iolock = XFS_IOLOCK_EXCL;
} else {
@@ -714,7 +714,7 @@ xfs_file_write_iter(
* allow an operation to fall back to buffered mode.
*/
ret = xfs_file_dio_aio_write(iocb, from);
- if (ret != -EREMCHG)
+ if (ret != -ENOTBLK)
return ret;
}

--
2.27.0


2020-07-21 20:37:12

by Darrick J. Wong

[permalink] [raw]
Subject: Re: [PATCH 1/3] xfs: use ENOTBLK for direct I/O to buffered I/O fallback

On Tue, Jul 21, 2020 at 08:31:55PM +0200, Christoph Hellwig wrote:
> This is what the classic fs/direct-io.c implementation and thuse other
> file systems use.
>
> Signed-off-by: Christoph Hellwig <[email protected]>

Looks ok to me,
Reviewed-by: Darrick J. Wong <[email protected]>

--D

> ---
> fs/xfs/xfs_file.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 00db81eac80d6c..a6ef90457abf97 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -505,7 +505,7 @@ xfs_file_dio_aio_write(
> */
> if (xfs_is_cow_inode(ip)) {
> trace_xfs_reflink_bounce_dio_write(ip, iocb->ki_pos, count);
> - return -EREMCHG;
> + return -ENOTBLK;
> }
> iolock = XFS_IOLOCK_EXCL;
> } else {
> @@ -714,7 +714,7 @@ xfs_file_write_iter(
> * allow an operation to fall back to buffered mode.
> */
> ret = xfs_file_dio_aio_write(iocb, from);
> - if (ret != -EREMCHG)
> + if (ret != -ENOTBLK)
> return ret;
> }
>
> --
> 2.27.0
>