linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernd Schubert <bernd.schubert@fastmail.fm>
To: Miklos Szeredi <miklos@szeredi.hu>, Bernd Schubert <bschubert@ddn.com>
Cc: linux-fsdevel@vger.kernel.org, dsingh@ddn.com,
	Hao Xu <howeyxu@tencent.com>
Subject: Re: [PATCH 3/5] fuse: Allow parallel direct writes for O_DIRECT
Date: Mon, 28 Aug 2023 16:21:11 +0200	[thread overview]
Message-ID: <daaf4e73-959f-46b7-5e99-e13c70b81d6e@fastmail.fm> (raw)
In-Reply-To: <CAJfpegveOAgam0Zb+xit9QLfLHpRNyqB=aGRt+JBvhO6g7JYVQ@mail.gmail.com>



On 8/28/23 12:42, Miklos Szeredi wrote:
> On Thu, 24 Aug 2023 at 17:08, Bernd Schubert <bschubert@ddn.com> wrote:
>>
>> Take a shared lock in fuse_cache_write_iter.
>>
>> Cc: Hao Xu <howeyxu@tencent.com>
>> Cc: Miklos Szeredi <miklos@szeredi.hu>
>> Cc: Dharmendra Singh <dsingh@ddn.com>
>> Cc: linux-fsdevel@vger.kernel.org
>> Signed-off-by: Bernd Schubert <bschubert@ddn.com>
>> ---
>>   fs/fuse/file.c | 21 ++++++++++++++++-----
>>   1 file changed, 16 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
>> index a16f9b6888de..905ce3bb0047 100644
>> --- a/fs/fuse/file.c
>> +++ b/fs/fuse/file.c
>> @@ -1314,9 +1314,10 @@ static bool fuse_dio_wr_exclusive_lock(struct kiocb *iocb, struct iov_iter *from
>>          struct file *file = iocb->ki_filp;
>>          struct fuse_file *ff = file->private_data;
>>
>> -       return  !(ff->open_flags & FOPEN_PARALLEL_DIRECT_WRITES) ||
>> -               iocb->ki_flags & IOCB_APPEND ||
>> -               fuse_direct_write_extending_i_size(iocb, from);
>> +       return ((!(iocb->ki_flags & IOCB_DIRECT)) ||
>> +               (!(ff->open_flags & FOPEN_PARALLEL_DIRECT_WRITES)) ||
> 
> Why the extra parenthesis around the negation in the above two conditions?
> 
> So this condition will always be true at this point when called from
> fuse_cache_write_iter()?  If so, you need to explain in the commit
> message why are you doing this at this point (e.g. future patches
> depend on this).

Oh, thanks for spotting, the double parenthesis were accidentally. 
Although I don't think it would have an effect, it just results in

return ((!(condition1)) || ...

I.e. does not change the condition itself?

Anyway, yeah, agreed on your comment in the patch before, with one 
condition per line it becomes easier to read and avoids parenthesis. I 
had just tried to keep the code as it is to make the patch easier to read.


Thanks,
Bernd

  reply	other threads:[~2023-08-28 14:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 15:05 [PATCH 0/5 v2] fuse direct write consolidation and parallel IO Bernd Schubert
2023-08-24 15:05 ` [PATCH 1/5] fuse: direct IO can use the write-through code path Bernd Schubert
2023-08-28 12:00   ` Miklos Szeredi
2023-08-24 15:05 ` [PATCH 2/5] fuse: Create helper function if DIO write needs exclusive lock Bernd Schubert
2023-08-28 10:33   ` Miklos Szeredi
2023-08-24 15:05 ` [PATCH 3/5] fuse: Allow parallel direct writes for O_DIRECT Bernd Schubert
2023-08-28 10:42   ` Miklos Szeredi
2023-08-28 14:21     ` Bernd Schubert [this message]
2023-08-28 15:15       ` Miklos Szeredi
2023-08-24 15:05 ` [PATCH 4/5] [RFC] fuse: Set and use IOCB_DIRECT when FOPEN_DIRECT_IO is set Bernd Schubert
2023-08-28 11:59   ` Miklos Szeredi
2023-08-28 14:48     ` Bernd Schubert
2023-08-28 15:05       ` Miklos Szeredi
2023-08-29 13:08         ` Bernd Schubert
2023-08-29 13:26           ` Bernd Schubert
2023-08-29 13:52             ` Bernd Schubert
2023-08-28 20:03     ` Bernd Schubert
2023-08-29  7:16       ` Miklos Szeredi
2023-08-24 15:05 ` [PATCH 5/5] fuse: Remove page flush/invaliation in fuse_direct_io Bernd Schubert
2023-08-28 12:01   ` Miklos Szeredi

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=daaf4e73-959f-46b7-5e99-e13c70b81d6e@fastmail.fm \
    --to=bernd.schubert@fastmail.fm \
    --cc=bschubert@ddn.com \
    --cc=dsingh@ddn.com \
    --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).