PostgreSQL Source Code git master
Loading...
Searching...
No Matches
aio_target.c File Reference
#include "postgres.h"
#include "storage/aio.h"
#include "storage/aio_internal.h"
#include "storage/smgr.h"
Include dependency graph for aio_target.c:

Go to the source code of this file.

Functions

bool pgaio_io_has_target (PgAioHandle *ioh)
 
const charpgaio_io_get_target_name (PgAioHandle *ioh)
 
void pgaio_io_set_target (PgAioHandle *ioh, PgAioTargetID targetid)
 
PgAioTargetDatapgaio_io_get_target_data (PgAioHandle *ioh)
 
charpgaio_io_get_target_description (PgAioHandle *ioh)
 
bool pgaio_io_can_reopen (PgAioHandle *ioh)
 
void pgaio_io_reopen (PgAioHandle *ioh)
 

Variables

static const PgAioTargetInfopgaio_target_info []
 

Function Documentation

◆ pgaio_io_can_reopen()

bool pgaio_io_can_reopen ( PgAioHandle ioh)

Definition at line 103 of file aio_target.c.

104{
105 Assert(ioh->target > PGAIO_TID_INVALID && ioh->target < PGAIO_TID_COUNT);
106
107 return pgaio_target_info[ioh->target]->reopen != NULL;
108}
#define PGAIO_TID_COUNT
Definition aio.h:123
@ PGAIO_TID_INVALID
Definition aio.h:119
static const PgAioTargetInfo * pgaio_target_info[]
Definition aio_target.c:25
#define Assert(condition)
Definition c.h:873
static int fb(int x)
void(* reopen)(PgAioHandle *ioh)
Definition aio.h:164

References Assert, fb(), pgaio_target_info, PGAIO_TID_COUNT, PGAIO_TID_INVALID, and PgAioTargetInfo::reopen.

Referenced by pgaio_worker_needs_synchronous_execution().

◆ pgaio_io_get_target_data()

PgAioTargetData * pgaio_io_get_target_data ( PgAioHandle ioh)

Definition at line 73 of file aio_target.c.

74{
75 return &ioh->target_data;
76}

References fb().

Referenced by buffer_readv_complete(), md_readv_complete(), pgaio_io_set_target_smgr(), shared_buffer_readv_complete_local(), and smgr_aio_reopen().

◆ pgaio_io_get_target_description()

char * pgaio_io_get_target_description ( PgAioHandle ioh)

Definition at line 84 of file aio_target.c.

85{
86 /* disallow INVALID, there wouldn't be a description */
87 Assert(ioh->target > PGAIO_TID_INVALID && ioh->target < PGAIO_TID_COUNT);
88
89 return pgaio_target_info[ioh->target]->describe_identity(&ioh->target_data);
90}
char *(* describe_identity)(const PgAioTargetData *sd)
Definition aio.h:167

References Assert, PgAioTargetInfo::describe_identity, fb(), pgaio_target_info, PGAIO_TID_COUNT, and PGAIO_TID_INVALID.

Referenced by pg_get_aios().

◆ pgaio_io_get_target_name()

const char * pgaio_io_get_target_name ( PgAioHandle ioh)

Definition at line 50 of file aio_target.c.

51{
52 /* explicitly allow INVALID here, function used by debug messages */
53 Assert(ioh->target >= PGAIO_TID_INVALID && ioh->target < PGAIO_TID_COUNT);
54
55 return pgaio_target_info[ioh->target]->name;
56}
const char * name
Definition aio.h:170

References Assert, fb(), PgAioTargetInfo::name, pgaio_target_info, PGAIO_TID_COUNT, and PGAIO_TID_INVALID.

Referenced by pg_get_aios().

◆ pgaio_io_has_target()

bool pgaio_io_has_target ( PgAioHandle ioh)

Definition at line 40 of file aio_target.c.

41{
42 return ioh->target != PGAIO_TID_INVALID;
43}

References fb(), and PGAIO_TID_INVALID.

Referenced by pgaio_io_before_start(), and pgaio_io_stage().

◆ pgaio_io_reopen()

void pgaio_io_reopen ( PgAioHandle ioh)

Definition at line 116 of file aio_target.c.

117{
118 Assert(ioh->target > PGAIO_TID_INVALID && ioh->target < PGAIO_TID_COUNT);
120
121 pgaio_target_info[ioh->target]->reopen(ioh);
122}
#define PGAIO_OP_COUNT
Definition aio.h:107
@ PGAIO_OP_INVALID
Definition aio.h:90

References Assert, fb(), PGAIO_OP_COUNT, PGAIO_OP_INVALID, pgaio_target_info, PGAIO_TID_COUNT, PGAIO_TID_INVALID, and PgAioTargetInfo::reopen.

Referenced by IoWorkerMain().

◆ pgaio_io_set_target()

void pgaio_io_set_target ( PgAioHandle ioh,
PgAioTargetID  targetid 
)

Definition at line 64 of file aio_target.c.

65{
67 Assert(ioh->target == PGAIO_TID_INVALID);
68
69 ioh->target = targetid;
70}
@ PGAIO_HS_HANDED_OUT

References Assert, fb(), PGAIO_HS_HANDED_OUT, and PGAIO_TID_INVALID.

Referenced by pgaio_io_set_target_smgr().

Variable Documentation

◆ pgaio_target_info

const PgAioTargetInfo* pgaio_target_info[]
static
Initial value:
= {
.name = "invalid",
},
}
@ PGAIO_TID_SMGR
Definition aio.h:120
const PgAioTargetInfo aio_smgr_target_info
Definition smgr.c:172

Definition at line 25 of file aio_target.c.

25 {
27 .name = "invalid",
28 },
30};

Referenced by pgaio_io_can_reopen(), pgaio_io_get_target_description(), pgaio_io_get_target_name(), and pgaio_io_reopen().