PostgreSQL Source Code git master
|
#include "lib/ilist.h"
#include "port/pg_iovec.h"
#include "storage/aio.h"
#include "storage/condition_variable.h"
Go to the source code of this file.
Data Structures | |
struct | PgAioHandle |
struct | PgAioBackend |
struct | PgAioCtl |
struct | IoMethodOps |
Macros | |
#define | PGAIO_SUBMIT_BATCH_SIZE 32 |
#define | PGAIO_VERBOSE 1 |
#define | pgaio_debug(elevel, msg, ...) |
#define | pgaio_debug_io(elevel, ioh, msg, ...) |
#define | pgaio_io_call_inj(ioh, injection_point) (void) 0 |
Typedefs | |
typedef enum PgAioHandleState | PgAioHandleState |
typedef struct PgAioBackend | PgAioBackend |
typedef struct PgAioCtl | PgAioCtl |
typedef struct IoMethodOps | IoMethodOps |
Enumerations | |
enum | PgAioHandleState { PGAIO_HS_IDLE = 0 , PGAIO_HS_HANDED_OUT , PGAIO_HS_DEFINED , PGAIO_HS_STAGED , PGAIO_HS_SUBMITTED , PGAIO_HS_COMPLETED_IO , PGAIO_HS_COMPLETED_SHARED , PGAIO_HS_COMPLETED_LOCAL } |
Functions | |
bool | pgaio_io_was_recycled (PgAioHandle *ioh, uint64 ref_generation, PgAioHandleState *state) |
void | pgaio_io_stage (PgAioHandle *ioh, PgAioOp op) |
void | pgaio_io_process_completion (PgAioHandle *ioh, int result) |
void | pgaio_io_prepare_submit (PgAioHandle *ioh) |
bool | pgaio_io_needs_synchronous_execution (PgAioHandle *ioh) |
const char * | pgaio_io_get_state_name (PgAioHandle *ioh) |
const char * | pgaio_result_status_string (PgAioResultStatus rs) |
void | pgaio_shutdown (int code, Datum arg) |
void | pgaio_io_call_stage (PgAioHandle *ioh) |
void | pgaio_io_call_complete_shared (PgAioHandle *ioh) |
void | pgaio_io_call_complete_local (PgAioHandle *ioh) |
void | pgaio_io_perform_synchronously (PgAioHandle *ioh) |
const char * | pgaio_io_get_op_name (PgAioHandle *ioh) |
bool | pgaio_io_can_reopen (PgAioHandle *ioh) |
void | pgaio_io_reopen (PgAioHandle *ioh) |
const char * | pgaio_io_get_target_name (PgAioHandle *ioh) |
Variables | |
PGDLLIMPORT const IoMethodOps | pgaio_sync_ops |
PGDLLIMPORT const IoMethodOps | pgaio_worker_ops |
PGDLLIMPORT const IoMethodOps * | pgaio_method_ops |
PGDLLIMPORT PgAioCtl * | pgaio_ctl |
PGDLLIMPORT PgAioBackend * | pgaio_my_backend |
#define pgaio_debug | ( | elevel, | |
msg, | |||
... | |||
) |
Definition at line 345 of file aio_internal.h.
#define pgaio_debug_io | ( | elevel, | |
ioh, | |||
msg, | |||
... | |||
) |
Definition at line 358 of file aio_internal.h.
#define pgaio_io_call_inj | ( | ioh, | |
injection_point | |||
) | (void) 0 |
Definition at line 376 of file aio_internal.h.
#define PGAIO_SUBMIT_BATCH_SIZE 32 |
Definition at line 28 of file aio_internal.h.
#define PGAIO_VERBOSE 1 |
Definition at line 334 of file aio_internal.h.
typedef struct IoMethodOps IoMethodOps |
typedef struct PgAioBackend PgAioBackend |
typedef enum PgAioHandleState PgAioHandleState |
enum PgAioHandleState |
Enumerator | |
---|---|
PGAIO_HS_IDLE | |
PGAIO_HS_HANDED_OUT | |
PGAIO_HS_DEFINED | |
PGAIO_HS_STAGED | |
PGAIO_HS_SUBMITTED | |
PGAIO_HS_COMPLETED_IO | |
PGAIO_HS_COMPLETED_SHARED | |
PGAIO_HS_COMPLETED_LOCAL |
Definition at line 38 of file aio_internal.h.
void pgaio_io_call_complete_local | ( | PgAioHandle * | ioh | ) |
Definition at line 268 of file aio_callback.c.
References aio_handle_cbs, Assert(), PgAioHandle::callbacks, PgAioHandle::callbacks_data, PgAioHandleCallbacksEntry::cb, PgAioHandleCallbacks::complete_local, DEBUG3, DEBUG4, PgAioHandle::distilled_result, END_CRIT_SECTION, PgAioResult::error_data, i, PgAioResult::id, PgAioHandleCallbacksEntry::name, PgAioHandle::num_callbacks, PgAioHandle::op, pgaio_debug_io, PGAIO_OP_COUNT, PGAIO_OP_INVALID, pgaio_result_status_string(), PGAIO_TID_COUNT, PGAIO_TID_INVALID, PgAioHandle::result, PgAioResult::result, START_CRIT_SECTION, PgAioResult::status, and PgAioHandle::target.
Referenced by pgaio_io_reclaim().
void pgaio_io_call_complete_shared | ( | PgAioHandle * | ioh | ) |
Definition at line 214 of file aio_callback.c.
References aio_handle_cbs, Assert(), PgAioHandle::callbacks, PgAioHandle::callbacks_data, PgAioHandleCallbacksEntry::cb, PgAioHandleCallbacks::complete_shared, DEBUG3, DEBUG4, PgAioHandle::distilled_result, END_CRIT_SECTION, PgAioResult::error_data, i, PgAioResult::id, PgAioHandleCallbacksEntry::name, PgAioHandle::num_callbacks, PgAioHandle::op, pgaio_debug_io, PGAIO_HCB_INVALID, PGAIO_OP_COUNT, PGAIO_OP_INVALID, pgaio_result_status_string(), PGAIO_RS_OK, PGAIO_TID_COUNT, PGAIO_TID_INVALID, PgAioHandle::result, PgAioResult::result, START_CRIT_SECTION, PgAioResult::status, and PgAioHandle::target.
Referenced by pgaio_io_process_completion().
void pgaio_io_call_stage | ( | PgAioHandle * | ioh | ) |
Definition at line 188 of file aio_callback.c.
References aio_handle_cbs, Assert(), PgAioHandle::callbacks, PgAioHandle::callbacks_data, PgAioHandleCallbacksEntry::cb, DEBUG3, i, PgAioHandleCallbacksEntry::name, PgAioHandle::num_callbacks, PgAioHandle::op, pgaio_debug_io, PGAIO_OP_COUNT, PGAIO_OP_INVALID, PGAIO_TID_COUNT, PGAIO_TID_INVALID, PgAioHandleCallbacks::stage, and PgAioHandle::target.
Referenced by pgaio_io_stage().
bool pgaio_io_can_reopen | ( | PgAioHandle * | ioh | ) |
Definition at line 97 of file aio_target.c.
References pgaio_target_info, PgAioTargetInfo::reopen, and PgAioHandle::target.
Referenced by pgaio_worker_needs_synchronous_execution().
const char * pgaio_io_get_op_name | ( | PgAioHandle * | ioh | ) |
Definition at line 169 of file aio_io.c.
References Assert(), PgAioHandle::op, PGAIO_OP_COUNT, PGAIO_OP_INVALID, PGAIO_OP_READV, and PGAIO_OP_WRITEV.
const char * pgaio_io_get_state_name | ( | PgAioHandle * | ioh | ) |
Definition at line 822 of file aio.c.
References pgaio_io_state_get_name(), and PgAioHandle::state.
const char * pgaio_io_get_target_name | ( | PgAioHandle * | ioh | ) |
Definition at line 48 of file aio_target.c.
References Assert(), PgAioTargetInfo::name, pgaio_target_info, PGAIO_TID_COUNT, and PgAioHandle::target.
bool pgaio_io_needs_synchronous_execution | ( | PgAioHandle * | ioh | ) |
Definition at line 447 of file aio.c.
References PgAioHandle::flags, IoMethodOps::needs_synchronous_execution, PGAIO_HF_SYNCHRONOUS, and pgaio_method_ops.
Referenced by pgaio_io_stage().
void pgaio_io_perform_synchronously | ( | PgAioHandle * | ioh | ) |
Definition at line 116 of file aio_io.c.
References elog, END_CRIT_SECTION, ERROR, PgAioOpData::fd, PgAioOpData::iov_length, PgAioHandle::iovec_off, PgAioCtl::iovecs, PgAioOpData::offset, PgAioHandle::op, PgAioHandle::op_data, pg_preadv(), pg_pwritev(), pgaio_ctl, pgaio_io_process_completion(), PGAIO_OP_INVALID, PGAIO_OP_READV, PGAIO_OP_WRITEV, pgstat_report_wait_end(), pgstat_report_wait_start(), PgAioOpData::read, PgAioHandle::result, START_CRIT_SECTION, and PgAioOpData::write.
Referenced by IoWorkerMain(), pgaio_io_stage(), and pgaio_worker_submit_internal().
void pgaio_io_prepare_submit | ( | PgAioHandle * | ioh | ) |
Definition at line 474 of file aio.c.
References dclist_push_tail(), PgAioBackend::in_flight_ios, PgAioHandle::node, PGAIO_HS_SUBMITTED, pgaio_io_update_state(), and pgaio_my_backend.
Referenced by pgaio_io_stage(), and pgaio_worker_submit().
void pgaio_io_process_completion | ( | PgAioHandle * | ioh, |
int | result | ||
) |
Definition at line 492 of file aio.c.
References Assert(), ConditionVariableBroadcast(), CritSectionCount, PgAioHandle::cv, MyProcNumber, PgAioHandle::owner_procno, PGAIO_HS_COMPLETED_IO, PGAIO_HS_COMPLETED_SHARED, PGAIO_HS_SUBMITTED, pgaio_io_call_complete_shared(), pgaio_io_call_inj, pgaio_io_reclaim(), pgaio_io_update_state(), PgAioHandle::result, and PgAioHandle::state.
Referenced by IoWorkerMain(), and pgaio_io_perform_synchronously().
void pgaio_io_reopen | ( | PgAioHandle * | ioh | ) |
Definition at line 108 of file aio_target.c.
References Assert(), PgAioHandle::op, PGAIO_OP_COUNT, pgaio_target_info, PGAIO_TID_COUNT, PgAioTargetInfo::reopen, and PgAioHandle::target.
Referenced by IoWorkerMain().
void pgaio_io_stage | ( | PgAioHandle * | ioh, |
PgAioOp | op | ||
) |
Definition at line 397 of file aio.c.
References Assert(), DEBUG3, PgAioBackend::handed_out_io, PgAioBackend::in_batchmode, PgAioBackend::num_staged_ios, PgAioHandle::op, pgaio_debug_io, PGAIO_HS_DEFINED, PGAIO_HS_HANDED_OUT, PGAIO_HS_STAGED, pgaio_io_call_stage(), pgaio_io_has_target(), pgaio_io_needs_synchronous_execution(), pgaio_io_perform_synchronously(), pgaio_io_prepare_submit(), pgaio_io_update_state(), pgaio_my_backend, PGAIO_SUBMIT_BATCH_SIZE, pgaio_submit_staged(), PgAioHandle::result, PgAioBackend::staged_ios, and PgAioHandle::state.
Referenced by pgaio_io_prep_readv(), and pgaio_io_prep_writev().
bool pgaio_io_was_recycled | ( | PgAioHandle * | ioh, |
uint64 | ref_generation, | ||
PgAioHandleState * | state | ||
) |
Definition at line 523 of file aio.c.
References PgAioHandle::generation, pg_read_barrier, and PgAioHandle::state.
Referenced by pgaio_io_wait(), and pgaio_wref_check_done().
const char * pgaio_result_status_string | ( | PgAioResultStatus | rs | ) |
Definition at line 828 of file aio.c.
References PGAIO_RS_ERROR, PGAIO_RS_OK, PGAIO_RS_PARTIAL, and PGAIO_RS_UNKNOWN.
Referenced by pgaio_io_call_complete_local(), pgaio_io_call_complete_shared(), and pgaio_io_reclaim().
void pgaio_shutdown | ( | int | code, |
Datum | arg | ||
) |
Definition at line 1127 of file aio.c.
References Assert(), AtEOXact_Aio(), dclist_head_element, dclist_is_empty(), PgAioHandle::generation, PgAioBackend::handed_out_io, PgAioBackend::in_flight_ios, pgaio_io_wait(), and pgaio_my_backend.
Referenced by pgaio_init_backend().
|
extern |
Definition at line 76 of file aio.c.
Referenced by AioShmemInit(), IoWorkerMain(), pgaio_init_backend(), pgaio_io_from_wref(), pgaio_io_get_handle_data(), pgaio_io_get_id(), pgaio_io_get_iovec(), pgaio_io_get_wref(), pgaio_io_perform_synchronously(), pgaio_io_set_handle_data_32(), pgaio_io_set_handle_data_64(), and pgaio_io_wait_for_free().
|
extern |
Definition at line 88 of file aio.c.
Referenced by AioShmemInit(), AioShmemSize(), assign_io_method(), pgaio_init_backend(), pgaio_io_needs_synchronous_execution(), pgaio_io_wait(), and pgaio_submit_staged().
|
extern |
Definition at line 79 of file aio.c.
Referenced by AtEOXact_Aio(), pgaio_closing_fd(), pgaio_enter_batchmode(), pgaio_error_cleanup(), pgaio_exit_batchmode(), pgaio_have_staged(), pgaio_init_backend(), pgaio_io_acquire_nb(), pgaio_io_before_prep(), pgaio_io_prepare_submit(), pgaio_io_reclaim(), pgaio_io_release(), pgaio_io_release_resowner(), pgaio_io_stage(), pgaio_io_wait_for_free(), pgaio_shutdown(), and pgaio_submit_staged().
|
extern |
Definition at line 28 of file method_sync.c.
|
extern |
Definition at line 82 of file method_worker.c.