1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-28 02:33:10 +03:00

Convert AIO to use the new shmem allocation functions

This replaces the "shmem_size" and "shmem_init" callbacks in the IO
methods table with the same ShmemCallback struct that we now use in
other subsystems

Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com
This commit is contained in:
Heikki Linnakangas
2026-04-06 02:13:04 +03:00
parent 2e0943a859
commit 58a1573385
7 changed files with 126 additions and 130 deletions

View File

@@ -20,6 +20,8 @@
#include "port/pg_iovec.h"
#include "storage/aio.h"
#include "storage/condition_variable.h"
#include "storage/ipc.h"
#include "storage/shmem.h"
/*
@@ -267,20 +269,8 @@ typedef struct IoMethodOps
*/
bool wait_on_fd_before_close;
/* global initialization */
/*
* Amount of additional shared memory to reserve for the io_method. Called
* just like a normal ipci.c style *Size() function. Optional.
*/
size_t (*shmem_size) (void);
/*
* Initialize shared memory. First time is true if AIO's shared memory was
* just initialized, false otherwise. Optional.
*/
void (*shmem_init) (bool first_time);
ShmemCallbacks shmem_callbacks;
/*
* Per-backend initialization. Optional.

View File

@@ -20,9 +20,6 @@
/* aio_init.c */
extern Size AioShmemSize(void);
extern void AioShmemInit(void);
extern void pgaio_init_backend(void);

View File

@@ -53,3 +53,6 @@ PG_SHMEM_SUBSYSTEM(ProcSignalShmemCallbacks)
/* other modules that need some shared memory space */
PG_SHMEM_SUBSYSTEM(AsyncShmemCallbacks)
/* AIO subsystem. This delegates to the method-specific callbacks */
PG_SHMEM_SUBSYSTEM(AioShmemCallbacks)