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 } |
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 376 of file aio_internal.h.
#define pgaio_debug_io | ( | elevel, | |
ioh, | |||
msg, | |||
... | |||
) |
Definition at line 389 of file aio_internal.h.
#define pgaio_io_call_inj | ( | ioh, | |
injection_point | |||
) | (void) 0 |
Definition at line 407 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 365 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 43 of file aio_internal.h.
PgAioResult pgaio_io_call_complete_local | ( | PgAioHandle * | ioh | ) |
Definition at line 282 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 225 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 199 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 103 of file aio_target.c.
References Assert(), pgaio_target_info, PGAIO_TID_COUNT, PGAIO_TID_INVALID, PgAioTargetInfo::reopen, and PgAioHandle::target.
Referenced by pgaio_worker_needs_synchronous_execution().
int pgaio_io_get_iovec_length | ( | PgAioHandle * | ioh, |
struct iovec ** | iov | ||
) |
Definition at line 219 of file aio_io.c.
References Assert(), PgAioOpData::iov_length, PgAioHandle::iovec_off, PgAioCtl::iovecs, PgAioHandle::op, PgAioHandle::op_data, pg_unreachable, pgaio_ctl, PGAIO_HS_DEFINED, PGAIO_OP_READV, PGAIO_OP_WRITEV, PgAioOpData::read, PgAioHandle::state, and PgAioOpData::write.
Referenced by IoWorkerMain().
const char * pgaio_io_get_op_name | ( | PgAioHandle * | ioh | ) |
Definition at line 175 of file aio_io.c.
References Assert(), PgAioHandle::op, PGAIO_OP_COUNT, PGAIO_OP_INVALID, PGAIO_OP_READV, and PGAIO_OP_WRITEV.
Referenced by pg_get_aios().
const char * pgaio_io_get_state_name | ( | PgAioHandle * | ioh | ) |
Definition at line 846 of file aio.c.
References pgaio_io_state_get_name(), and PgAioHandle::state.
Referenced by pg_get_aios().
const char * pgaio_io_get_target_name | ( | PgAioHandle * | ioh | ) |
Definition at line 50 of file aio_target.c.
References Assert(), PgAioTargetInfo::name, pgaio_target_info, PGAIO_TID_COUNT, PGAIO_TID_INVALID, and PgAioHandle::target.
Referenced by pg_get_aios().
bool pgaio_io_needs_synchronous_execution | ( | PgAioHandle * | ioh | ) |
Definition at line 455 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 482 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 500 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 116 of file aio_target.c.
References Assert(), PgAioHandle::op, PGAIO_OP_COUNT, PGAIO_OP_INVALID, pgaio_target_info, PGAIO_TID_COUNT, PGAIO_TID_INVALID, PgAioTargetInfo::reopen, and PgAioHandle::target.
Referenced by IoWorkerMain().
void pgaio_io_stage | ( | PgAioHandle * | ioh, |
PgAioOp | op | ||
) |
Definition at line 405 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_start_readv(), and pgaio_io_start_writev().
bool pgaio_io_uses_fd | ( | PgAioHandle * | ioh, |
int | fd | ||
) |
Definition at line 197 of file aio_io.c.
References Assert(), PgAioOpData::fd, fd(), PgAioHandle::op, PgAioHandle::op_data, PGAIO_HS_DEFINED, PGAIO_OP_INVALID, PGAIO_OP_READV, PGAIO_OP_WRITEV, PgAioOpData::read, PgAioHandle::state, and PgAioOpData::write.
Referenced by pgaio_closing_fd().
bool pgaio_io_was_recycled | ( | PgAioHandle * | ioh, |
uint64 | ref_generation, | ||
PgAioHandleState * | state | ||
) |
Definition at line 531 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 852 of file aio.c.
References PGAIO_RS_ERROR, PGAIO_RS_OK, PGAIO_RS_PARTIAL, PGAIO_RS_UNKNOWN, and PGAIO_RS_WARNING.
Referenced by pg_get_aios(), pgaio_io_call_complete_local(), pgaio_io_call_complete_shared(), and pgaio_io_reclaim().
void pgaio_shutdown | ( | int | code, |
Datum | arg | ||
) |
Definition at line 1198 of file aio.c.
References Assert(), AtEOXact_Aio(), dclist_count(), dclist_head_element, dclist_is_empty(), DEBUG2, PgAioHandle::generation, PgAioBackend::handed_out_io, PgAioBackend::in_flight_ios, pgaio_debug_io, pgaio_io_wait(), and pgaio_my_backend.
Referenced by pgaio_init_backend().
|
extern |
Definition at line 81 of file aio.c.
Referenced by AioShmemInit(), IoWorkerMain(), pg_get_aios(), pgaio_init_backend(), pgaio_io_from_wref(), pgaio_io_get_handle_data(), pgaio_io_get_id(), pgaio_io_get_iovec(), pgaio_io_get_iovec_length(), 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 96 of file aio.c.
Referenced by AioShmemInit(), AioShmemSize(), assign_io_method(), pgaio_closing_fd(), pgaio_init_backend(), pgaio_io_needs_synchronous_execution(), pgaio_io_wait(), and pgaio_submit_staged().
|
extern |
Definition at line 84 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_start(), 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 83 of file method_worker.c.