PostgreSQL Source Code git master
Loading...
Searching...
No Matches
aio_subsys.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void pgaio_init_backend (void)
 
void pgaio_error_cleanup (void)
 
void AtEOXact_Aio (bool is_commit)
 
bool pgaio_workers_enabled (void)
 

Function Documentation

◆ AtEOXact_Aio()

void AtEOXact_Aio ( bool  is_commit)
extern

Definition at line 1203 of file aio.c.

1204{
1205 /*
1206 * We should never be in batch mode at transactional boundaries. In case
1207 * an error was thrown while in batch mode, pgaio_error_cleanup() should
1208 * have exited batchmode.
1209 *
1210 * In case we are in batchmode somehow, make sure to submit all staged
1211 * IOs, other backends may need them to complete to continue.
1212 */
1214 {
1216 elog(WARNING, "open AIO batch at end of (sub-)transaction");
1217 }
1218
1219 /*
1220 * As we aren't in batchmode, there shouldn't be any unsubmitted IOs.
1221 */
1223}
PgAioBackend * pgaio_my_backend
Definition aio.c:81
void pgaio_error_cleanup(void)
Definition aio.c:1175
#define Assert(condition)
Definition c.h:943
#define WARNING
Definition elog.h:37
#define elog(elevel,...)
Definition elog.h:228
uint16 num_staged_ios

References Assert, elog, PgAioBackend::in_batchmode, PgAioBackend::num_staged_ios, pgaio_error_cleanup(), pgaio_my_backend, and WARNING.

Referenced by AbortSubTransaction(), AbortTransaction(), CommitTransaction(), pgaio_shutdown(), and PrepareTransaction().

◆ pgaio_error_cleanup()

void pgaio_error_cleanup ( void  )
extern

Definition at line 1175 of file aio.c.

1176{
1177 /*
1178 * It is possible that code errored out after pgaio_enter_batchmode() but
1179 * before pgaio_exit_batchmode() was called. In that case we need to
1180 * submit the IO now.
1181 */
1183 {
1185
1187 }
1188
1189 /*
1190 * As we aren't in batchmode, there shouldn't be any unsubmitted IOs.
1191 */
1193}
void pgaio_submit_staged(void)
Definition aio.c:1133

References Assert, PgAioBackend::in_batchmode, PgAioBackend::num_staged_ios, pgaio_my_backend, and pgaio_submit_staged().

Referenced by AbortSubTransaction(), AbortTransaction(), AtEOXact_Aio(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), pgarch_archiveXlog(), WalSndErrorCleanup(), WalSummarizerMain(), and WalWriterMain().

◆ pgaio_init_backend()

void pgaio_init_backend ( void  )
extern

Definition at line 238 of file aio_init.c.

239{
240 /* shouldn't be initialized twice */
242
244 return;
245
246 if (MyProc == NULL || MyProcNumber >= AioProcs())
247 elog(ERROR, "aio requires a normal PGPROC");
248
250
253
255}
PgAioCtl * pgaio_ctl
Definition aio.c:78
const IoMethodOps * pgaio_method_ops
Definition aio.c:96
void pgaio_shutdown(int code, Datum arg)
Definition aio.c:1298
static uint32 AioProcs(void)
Definition aio_init.c:46
#define ERROR
Definition elog.h:40
ProcNumber MyProcNumber
Definition globals.c:92
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition ipc.c:344
@ B_IO_WORKER
Definition miscadmin.h:376
BackendType MyBackendType
Definition miscinit.c:65
static int fb(int x)
PGPROC * MyProc
Definition proc.c:71
void(* init_backend)(void)
PgAioBackend * backend_state

References AioProcs(), Assert, B_IO_WORKER, PgAioCtl::backend_state, before_shmem_exit(), elog, ERROR, fb(), IoMethodOps::init_backend, MyBackendType, MyProc, MyProcNumber, pgaio_ctl, pgaio_method_ops, pgaio_my_backend, and pgaio_shutdown().

Referenced by BaseInit().

◆ pgaio_workers_enabled()

bool pgaio_workers_enabled ( void  )
extern

Definition at line 1028 of file method_worker.c.

1029{
1030 return io_method == IOMETHOD_WORKER;
1031}
int io_method
Definition aio.c:74
@ IOMETHOD_WORKER
Definition aio.h:35

References io_method, and IOMETHOD_WORKER.

Referenced by maybe_start_io_workers_scheduled_at().