diff options
| author | Yuto Ohnuki <ytohnuki@amazon.com> | 2026-02-23 17:03:33 +0300 |
|---|---|---|
| committer | Miklos Szeredi <mszeredi@redhat.com> | 2026-02-27 17:16:34 +0300 |
| commit | 9587fde0da0365d300ea1c967e63ad3fe09b883e (patch) | |
| tree | f832c03612b97147f514a0ef950ce77ec8839fa9 | |
| parent | 68b69fa0edb241a946cd4c850110990f30705164 (diff) | |
| download | linux-9587fde0da0365d300ea1c967e63ad3fe09b883e.tar.xz | |
fuse: refactor duplicate queue teardown operation
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>
Reviewed-by: Bernd Schubert <bernd@bsbernd.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| -rw-r--r-- | fs/fuse/dev_uring.c | 36 |
1 files 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; |
