aio: Improve assertions related to io_method

Andres Freund <andres@anarazel.de>

Commit: dae00f333bdd98d094275080dba248cc80d4ca04
Author: Andres Freund <andres@anarazel.de>
Date: 2025-11-05T01:03:53Z
aio: Improve assertions related to io_method

First, the assertions in assign_io_method() were the wrong way round. Second,
the lengthof() assertion checked the length of io_method_options, which is the
wrong array to check and is always longer than pgaio_method_ops_table.

While add it, add a static assert to ensure pgaio_method_ops_table and
io_method_options stay in sync.

Per coverity and Tom Lane.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 18

Files

PathChange+/−
src/backend/storage/aio/aio.c modified +4 −1