* [PATCH] fuse: refactor duplicate queue teardown operation
@ 2026-02-23 14:03 Yuto Ohnuki
2026-02-25 3:24 ` Bernd Schubert
2026-02-27 15:59 ` Miklos Szeredi
0 siblings, 2 replies; 3+ messages in thread
From: Yuto Ohnuki @ 2026-02-23 14:03 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: Bernd Schubert, linux-fsdevel, linux-kernel, Yuto Ohnuki
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;
--
2.50.1
Amazon Web Services EMEA SARL, 38 avenue John F. Kennedy, L-1855 Luxembourg, R.C.S. Luxembourg B186284
Amazon Web Services EMEA SARL, Irish Branch, One Burlington Plaza, Burlington Road, Dublin 4, Ireland, branch registration number 908705
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] fuse: refactor duplicate queue teardown operation
2026-02-23 14:03 [PATCH] fuse: refactor duplicate queue teardown operation Yuto Ohnuki
@ 2026-02-25 3:24 ` Bernd Schubert
2026-02-27 15:59 ` Miklos Szeredi
1 sibling, 0 replies; 3+ messages in thread
From: Bernd Schubert @ 2026-02-25 3:24 UTC (permalink / raw)
To: Yuto Ohnuki, Miklos Szeredi; +Cc: Bernd Schubert, linux-fsdevel, linux-kernel
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>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] fuse: refactor duplicate queue teardown operation
2026-02-23 14:03 [PATCH] fuse: refactor duplicate queue teardown operation Yuto Ohnuki
2026-02-25 3:24 ` Bernd Schubert
@ 2026-02-27 15:59 ` Miklos Szeredi
1 sibling, 0 replies; 3+ messages in thread
From: Miklos Szeredi @ 2026-02-27 15:59 UTC (permalink / raw)
To: Yuto Ohnuki; +Cc: Bernd Schubert, linux-fsdevel, linux-kernel
On Mon, 23 Feb 2026 at 15:03, Yuto Ohnuki <ytohnuki@amazon.com> 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>
Applied, thanks.
Miklos
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-27 15:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 14:03 [PATCH] fuse: refactor duplicate queue teardown operation Yuto Ohnuki
2026-02-25 3:24 ` Bernd Schubert
2026-02-27 15:59 ` Miklos Szeredi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox