Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Yuto Ohnuki and committed by
Miklos Szeredi
9587fde0 68b69fa0

+16 -20
+16 -20
fs/fuse/dev_uring.c
··· 397 397 FRRS_AVAILABLE); 398 398 } 399 399 400 + static void fuse_uring_teardown_all_queues(struct fuse_ring *ring) 401 + { 402 + int qid; 403 + 404 + for (qid = 0; qid < ring->nr_queues; qid++) { 405 + struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]); 406 + 407 + if (!queue) 408 + continue; 409 + 410 + fuse_uring_teardown_entries(queue); 411 + } 412 + } 413 + 400 414 /* 401 415 * Log state debug info 402 416 */ ··· 445 431 446 432 static void fuse_uring_async_stop_queues(struct work_struct *work) 447 433 { 448 - int qid; 449 434 struct fuse_ring *ring = 450 435 container_of(work, struct fuse_ring, async_teardown_work.work); 451 436 452 - /* XXX code dup */ 453 - for (qid = 0; qid < ring->nr_queues; qid++) { 454 - struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]); 455 - 456 - if (!queue) 457 - continue; 458 - 459 - fuse_uring_teardown_entries(queue); 460 - } 437 + fuse_uring_teardown_all_queues(ring); 461 438 462 439 /* 463 440 * Some ring entries might be in the middle of IO operations, ··· 474 469 */ 475 470 void fuse_uring_stop_queues(struct fuse_ring *ring) 476 471 { 477 - int qid; 478 - 479 - for (qid = 0; qid < ring->nr_queues; qid++) { 480 - struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]); 481 - 482 - if (!queue) 483 - continue; 484 - 485 - fuse_uring_teardown_entries(queue); 486 - } 472 + fuse_uring_teardown_all_queues(ring); 487 473 488 474 if (atomic_read(&ring->queue_refs) > 0) { 489 475 ring->teardown_time = jiffies;