I've replaced the hardcoded arithmetic expression for calculating TotalProcs within the pgaio_uring_shmem_init() with a call to the dedicated pgaio_uring_procs() function.
This can make the code's intent clearer. Simplifies future modifications to the calculation, as it only needs to be updated in one place. -- Regards, Japin Li
>From c3477213ff64788d32430361a8298c8f8a958238 Mon Sep 17 00:00:00 2001 From: Japin Li <japi...@hotmail.com> Date: Tue, 3 Jun 2025 12:07:04 +0800 Subject: [PATCH v1] Encapsulate io_uring process count calculation Replace the direct arithmetic expression for TotalProcs with a call to pgaio_uring_procs() in pgaio_uring_shmem_init(). --- src/backend/storage/aio/method_io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/storage/aio/method_io_uring.c b/src/backend/storage/aio/method_io_uring.c index c719ba2727a..cc312b641ca 100644 --- a/src/backend/storage/aio/method_io_uring.c +++ b/src/backend/storage/aio/method_io_uring.c @@ -126,7 +126,7 @@ pgaio_uring_shmem_size(void) static void pgaio_uring_shmem_init(bool first_time) { - int TotalProcs = MaxBackends + NUM_AUXILIARY_PROCS - MAX_IO_WORKERS; + int TotalProcs = pgaio_uring_procs(); bool found; pgaio_uring_contexts = (PgAioUringContext *) -- 2.43.0