On 8/24/23 06:32, Hao Xu wrote:
On 8/22/23 17:53, Miklos Szeredi via fuse-devel wrote:
On Mon, 21 Aug 2023 at 19:48, Bernd Schubert <bschubert@xxxxxxx> wrote:
There were two code paths direct-io writes could
take. When daemon/server side did not set FOPEN_DIRECT_IO
fuse_cache_write_iter -> direct_write_fallback
and with FOPEN_DIRECT_IO being set
fuse_direct_write_iter
Advantage of fuse_direct_write_iter is that it has optimizations
for parallel DIO writes - it might only take a shared inode lock,
instead of the exclusive lock.
With commits b5a2a3a0b776/80e4f25262f9 the fuse_direct_write_iter
path also handles concurrent page IO (dirty flush and page release),
just the condition on fc->direct_io_relax had to be removed.
Performance wise this basically gives the same improvements as
commit 153524053bbb, just O_DIRECT is sufficient, without the need
that server side sets FOPEN_DIRECT_IO
(it has to set FOPEN_PARALLEL_DIRECT_WRITES), though.
Consolidating the various direct IO paths would be really nice.
Problem is that fuse_direct_write_iter() lacks some code from
generic_file_direct_write() and also completely lacks
I see, seems the page invalidation post direct write is needed
as well.
I'm in the middle of verifying code paths, but I wonder if we can
remove the entire function at all.
https://github.com/bsbernd/linux/commit/fe082a0795fe5839211488e9645732b5f3809bea
on this branch
https://github.com/bsbernd/linux/commits/o-direct-shared-lock
Also totally untested - I hope I did not miss anything...
Thanks,
Bernd