From: Bernd Schubert <bernd@bsbernd.com>
To: Yuto Ohnuki <ytohnuki@amazon.com>, Miklos Szeredi <miklos@szeredi.hu>
Cc: Bernd Schubert <bschubert@ddn.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fuse: refactor duplicate queue teardown operation
Date: Wed, 25 Feb 2026 04:24:01 +0100 [thread overview]
Message-ID: <deb6002f-2784-46e6-8bac-15dbd9d2dc67@bsbernd.com> (raw)
In-Reply-To: <20260223140332.36618-2-ytohnuki@amazon.com>
On 2/23/26 15:03, Yuto Ohnuki wrote:
> Extract common queue iteration and teardown logic into
> fuse_uring_teardown_all_queues() helper function to eliminate code
> duplication between fuse_uring_async_stop_queues() and
> fuse_uring_stop_queues().
>
> This is a pure refactoring with no functional changes, intended to
> improve maintainability.
>
> Signed-off-by: Yuto Ohnuki <ytohnuki@amazon.com>
> ---
> fs/fuse/dev_uring.c | 36 ++++++++++++++++--------------------
> 1 file changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
> index 3a38b61aac26..7b9822e8837b 100644
> --- a/fs/fuse/dev_uring.c
> +++ b/fs/fuse/dev_uring.c
> @@ -397,6 +397,20 @@ static void fuse_uring_teardown_entries(struct fuse_ring_queue *queue)
> FRRS_AVAILABLE);
> }
>
> +static void fuse_uring_teardown_all_queues(struct fuse_ring *ring)
> +{
> + int qid;
> +
> + for (qid = 0; qid < ring->nr_queues; qid++) {
> + struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]);
> +
> + if (!queue)
> + continue;
> +
> + fuse_uring_teardown_entries(queue);
> + }
> +}
> +
> /*
> * Log state debug info
> */
> @@ -431,19 +445,10 @@ static void fuse_uring_log_ent_state(struct fuse_ring *ring)
>
> static void fuse_uring_async_stop_queues(struct work_struct *work)
> {
> - int qid;
> struct fuse_ring *ring =
> container_of(work, struct fuse_ring, async_teardown_work.work);
>
> - /* XXX code dup */
> - for (qid = 0; qid < ring->nr_queues; qid++) {
> - struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]);
> -
> - if (!queue)
> - continue;
> -
> - fuse_uring_teardown_entries(queue);
> - }
> + fuse_uring_teardown_all_queues(ring);
>
> /*
> * Some ring entries might be in the middle of IO operations,
> @@ -469,16 +474,7 @@ static void fuse_uring_async_stop_queues(struct work_struct *work)
> */
> void fuse_uring_stop_queues(struct fuse_ring *ring)
> {
> - int qid;
> -
> - for (qid = 0; qid < ring->nr_queues; qid++) {
> - struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]);
> -
> - if (!queue)
> - continue;
> -
> - fuse_uring_teardown_entries(queue);
> - }
> + fuse_uring_teardown_all_queues(ring);
>
> if (atomic_read(&ring->queue_refs) > 0) {
> ring->teardown_time = jiffies;
Thank you! Looks good to me.
Reviewed-by: Bernd Schubert <bernd@bsbernd.com>
next prev parent reply other threads:[~2026-02-25 3:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 14:03 Yuto Ohnuki
2026-02-25 3:24 ` Bernd Schubert [this message]
2026-02-27 15:59 ` 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=deb6002f-2784-46e6-8bac-15dbd9d2dc67@bsbernd.com \
--to=bernd@bsbernd.com \
--cc=bschubert@ddn.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=ytohnuki@amazon.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®