linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernd Schubert <bernd.schubert@fastmail.fm>
To: qiwuchen55@gmail.com, miklos@szeredi.hu
Cc: linux-fsdevel@vger.kernel.org, chenqiwu <chenqiwu@xiaomi.com>,
	Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] fuse: fix inode rwsem regression
Date: Sun, 2 Feb 2020 00:09:50 +0100	[thread overview]
Message-ID: <668fc86f-4214-f315-9b41-40368ba91022@fastmail.fm> (raw)
In-Reply-To: <1580536171-27838-1-git-send-email-qiwuchen55@gmail.com>



On 2/1/20 6:49 AM, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
> 
> Apparently our current rwsem code doesn't like doing the trylock, then
> lock for real scheme.  So change our direct write method to just do the
> trylock for the RWF_NOWAIT case.
> This seems to fix AIM7 regression in some scalable filesystems upto ~25%
> in some cases. Claimed in commit 942491c9e6d6 ("xfs: fix AIM7 regression")
> 
> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
> ---
>  fs/fuse/file.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index ce71538..ac16994 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -1529,7 +1529,13 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from)
>  	ssize_t res;
>  
>  	/* Don't allow parallel writes to the same file */
> -	inode_lock(inode);
> +	if (iocb->ki_flags & IOCB_NOWAIT) {
> +		if (!inode_trylock(inode))
> +			return -EAGAIN;
> +	} else {
> +		inode_lock(inode);
> +	}
> +
>  	res = generic_write_checks(iocb, from);
>  	if (res > 0) {
>  		if (!is_sync_kiocb(iocb) && iocb->ki_flags & IOCB_DIRECT) {
> 


I would actually like to ask if we can do something about this lock
altogether. Replace it with a range lock?  This very lock badly hurts
fuse shared file performance and maybe I miss something, but it should
be needed only for writes/reads going into the same file?


Thanks,
Bernd

  parent reply	other threads:[~2020-02-01 23:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-01  5:49 [PATCH] fuse: fix inode rwsem regression qiwuchen55
2020-02-01 15:47 ` Matthew Wilcox
2020-02-01 23:09 ` Bernd Schubert [this message]
2020-02-02  2:08   ` chenqiwu
2020-02-02 21:18     ` Bernd Schubert
2020-02-03  3:20       ` chenqiwu
2020-02-13  9:50       ` 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=668fc86f-4214-f315-9b41-40368ba91022@fastmail.fm \
    --to=bernd.schubert@fastmail.fm \
    --cc=chenqiwu@xiaomi.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=qiwuchen55@gmail.com \
    --cc=willy@infradead.org \
    /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).