Re:[PATCH] fuse: remove useless IOCB_DIRECT in fuse_direct_read/write_iter

From: yangyun
Date: Tue Aug 27 2024 - 07:43:26 EST


On Mon, Aug 26, 2024 at 09:12:39PM +0200, Miklos Szeredi wrote:
> On Mon, 26 Aug 2024 at 15:07, yangyun <yangyun50@xxxxxxxxxx> wrote:
> >
> > Commit 23c94e1cdcbf ("fuse: Switch to using async direct IO
> > for FOPEN_DIRECT_IO") gave the async direct IO code path in the
> > fuse_direct_read_iter() and fuse_direct_write_iter(). But since
> > these two functions are only called under FOPEN_DIRECT_IO is set,
> > it seems that we can also use the async direct IO even the flag
> > IOCB_DIRECT is not set to enjoy the async direct IO method. Also
> > move the definition of fuse_io_priv to where it is used in fuse_
> > direct_write_iter.
>
> I'm interested in the motivation for this patch.
>
> There's a minor risk of regressions when introducing such a behavior
> change, so there should also be a strong supporting argument, which
> seems to be missing in this case.

Thanks for your reply!

It seems that there is a risk of regressions. But I think adding an argument
in this case is not so graceful, whatever adding this argument to the
`struct fuse_file->open_flags` or adding it to the init flags in `struct
fuse_init_args`.

The reasons are:

1. Commit 23c94e1cdcbf ("fuse: Switch to using async direct IO for FOPEN_DIRECT_IO")
also changes the behavior from sync to async direct io, but does not import a new
argument to avoid the risk of regressions.

2. Fuse already has an init flags FUSE_ASYNC_DIO in `fuse_init_args`, which indicates
that the direct io should be submitted asynchrounously. The comment in function
`fuse_direct_IO()` also indicates the situation:
"
/*
* By default, we want to optimize all I/Os with async request
* submission to the client filesystem if supported.
*/
"
But the code does not go through the async direct io code path in the case described in current patch.

3. If adding a argument, it would be so many arguments about async and direct io (FUSE_ASYNC_DIO,
FUSE_ASYNC_READ, FOPEN_DIRECT_IO, etc), which may be redundant and confuse the developers about
their differences.

What do you think ?

>
> Thanks,
> Miklos