From: Bernd Schubert <bernd.schubert@fastmail.fm>
To: Miklos Szeredi <miklos@szeredi.hu>, Bernd Schubert <bschubert@ddn.com>
Cc: linux-fsdevel@vger.kernel.org, fuse-devel@lists.sourceforge.net,
Hao Xu <howeyxu@tencent.com>,
Christoph Hellwig <hch@infradead.org>,
Dharmendra Singh <dsingh@ddn.com>
Subject: Re: [PATCH 1/2] [RFC for fuse-next ] fuse: DIO writes always use the same code path
Date: Tue, 22 Aug 2023 20:46:57 +0200 [thread overview]
Message-ID: <1d58149e-d21f-e809-6ddc-25045268a0e0@fastmail.fm> (raw)
In-Reply-To: <CAJfpegv6Q5O435xSrYUMEQAvvkObV6gWws8Ju7C+PrSKwjmSew@mail.gmail.com>
On 8/22/23 11:53, Miklos Szeredi wrote:
> On Mon, 21 Aug 2023 at 19:48, Bernd Schubert <bschubert@ddn.com> 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
> direct_write_fallback(). So more thought needs to go into this.
Thanks for looking at it! Hmm, right, I see. I guess at least
direct_write_fallback() should be done for the new relaxed
mmap mode.
Entirely duplicating generic_file_direct_write()
to generic_file_direct_write doesn't seem to be nice either.
Regarding the inode lock, it might be easier to
change fuse_cache_write_iter() to a shared lock, although that
does not help when fc->writeback_cache is enabled, which has yet
another code path. Although I'm not sure that is needed
direct IO. For the start, what do you think about
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 1cdb6327511e..b1b9f2b9a37d 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1307,7 +1307,7 @@ static ssize_t fuse_cache_write_iter(struct kiocb *iocb, struct iov_iter *from)
ssize_t err;
struct fuse_conn *fc = get_fuse_conn(inode);
- if (fc->writeback_cache) {
+ if (fc->writeback_cache && !(iocb->ki_flags & IOCB_DIRECT)) {
/* Update size (EOF optimization) and mode (SUID clearing) */
err = fuse_update_attributes(mapping->host, file,
STATX_SIZE | STATX_MODE);
Thanks,
Bernd
next prev parent reply other threads:[~2023-08-22 18:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-21 17:47 [PATCH RFC -next 0/2] fuse: Parallel DIO writes with O_DIRECT Bernd Schubert
2023-08-21 17:47 ` [PATCH 1/2] [RFC for fuse-next ] fuse: DIO writes always use the same code path Bernd Schubert
2023-08-22 9:53 ` Miklos Szeredi
2023-08-22 18:46 ` Bernd Schubert [this message]
2023-08-23 6:10 ` Miklos Szeredi
2023-08-24 4:32 ` [fuse-devel] " Hao Xu
2023-08-24 9:43 ` Bernd Schubert
2023-08-24 9:51 ` Bernd Schubert
2023-08-21 17:47 ` [PATCH 2/2] libfs: Remove export of direct_write_fallback Bernd Schubert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d58149e-d21f-e809-6ddc-25045268a0e0@fastmail.fm \
--to=bernd.schubert@fastmail.fm \
--cc=bschubert@ddn.com \
--cc=dsingh@ddn.com \
--cc=fuse-devel@lists.sourceforge.net \
--cc=hch@infradead.org \
--cc=howeyxu@tencent.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).