From: Bernd Schubert <bernd.schubert@fastmail.fm>
To: Kemeng Shi <shikemeng@huaweicloud.com>,
miklos@szeredi.hu, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] fuse: move FR_WAITING set from fuse_request_queue_background to fuse_simple_background
Date: Fri, 8 Sep 2023 00:51:05 +0200 [thread overview]
Message-ID: <02da2f84-4463-0098-4ef9-e3d9622babe6@fastmail.fm> (raw)
In-Reply-To: <20230904143018.5709-2-shikemeng@huaweicloud.com>
On 9/4/23 16:30, Kemeng Shi wrote:
> Current way to set FR_WAITING in fuse_simple_background:
> fuse_simple_background
> if (args->force)
> fuse_request_alloc
> /* need to increase num_waiting before request is queued */
> else
> fuse_get_req
> atomic_inc(&fc->num_waiting);
> __set_bit(FR_WAITING, &req->flags);
>
> fuse_request_queue_background
> if (!test_bit(FR_WAITING, &req->flags)
> __set_bit(FR_WAITING, &req->flags);
> atomic_inc(&fc->num_waiting);
>
> We only need to increase num_waiting for force allocated reqeust in
> fuse_request_queue_background. Simply increase num_waiting in force block
> to remove unnecessary test_bit(FR_WAITING).
> This patch also makes it more intuitive to remove FR_WATING usage in next
> commit.
Very minor nit 'FR_WAITING'. The patch looks good to me.
>
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
> fs/fuse/dev.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index 1a8f82f478cb..59e1357d4880 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -528,10 +528,6 @@ static bool fuse_request_queue_background(struct fuse_req *req)
> bool queued = false;
>
> WARN_ON(!test_bit(FR_BACKGROUND, &req->flags));
> - if (!test_bit(FR_WAITING, &req->flags)) {
> - __set_bit(FR_WAITING, &req->flags);
> - atomic_inc(&fc->num_waiting);
> - }
> __set_bit(FR_ISREPLY, &req->flags);
> spin_lock(&fc->bg_lock);
> if (likely(fc->connected)) {
> @@ -553,10 +549,14 @@ int fuse_simple_background(struct fuse_mount *fm, struct fuse_args *args,
> struct fuse_req *req;
>
> if (args->force) {
> + struct fuse_conn *fc = fm->fc;
> +
> WARN_ON(!args->nocreds);
> req = fuse_request_alloc(fm, gfp_flags);
> if (!req)
> return -ENOMEM;
> + atomic_inc(&fc->num_waiting);
> + __set_bit(FR_WAITING, &req->flags);
> __set_bit(FR_BACKGROUND, &req->flags);
> } else {
> WARN_ON(args->nocreds);
next prev parent reply other threads:[~2023-09-07 22:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-04 14:30 [PATCH 0/3] Minor cleanups to fuse Kemeng Shi
2023-09-04 14:30 ` [PATCH 1/3] fuse: move FR_WAITING set from fuse_request_queue_background to fuse_simple_background Kemeng Shi
2023-09-07 22:51 ` Bernd Schubert [this message]
2023-09-04 14:30 ` [PATCH 2/3] fuse: remove usage of FR_WATING flag Kemeng Shi
2023-09-07 22:53 ` Bernd Schubert
2023-09-04 14:30 ` [PATCH 3/3] fuse: move fuse_put_request a bit to remove forward declaration Kemeng Shi
2023-09-07 22:55 ` Bernd Schubert
2023-09-12 7:03 ` Kemeng Shi
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=02da2f84-4463-0098-4ef9-e3d9622babe6@fastmail.fm \
--to=bernd.schubert@fastmail.fm \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=shikemeng@huaweicloud.com \
/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
all inboxes | Powered by JetHome®