|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "lib/ilist.h"#include "miscadmin.h"#include "port/atomics.h"#include "storage/aio.h"#include "storage/aio_internal.h"#include "storage/aio_subsys.h"#include "utils/guc.h"#include "utils/guc_hooks.h"#include "utils/injection_point.h"#include "utils/resowner.h"#include "utils/wait_event_types.h"
Go to the source code of this file.
Macros | |
| #define | PGAIO_HS_TOSTR_CASE(sym) case PGAIO_HS_##sym: return #sym |
Definition at line 1322 of file aio.c.
References Assert, fb(), lengthof, newval, pgaio_method_ops, and pgaio_method_ops_table.
Definition at line 1193 of file aio.c.
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().
Definition at line 1331 of file aio.c.
References GUC_check_errdetail, and newval.
Definition at line 1220 of file aio.c.
References dlist_iter::cur, dclist_container, dclist_count(), dclist_foreach, dclist_is_empty(), DEBUG2, fb(), fd(), PgAioBackend::in_flight_ios, PgAioBackend::num_staged_ios, pgaio_debug, pgaio_debug_io, pgaio_io_uses_fd(), pgaio_io_wait(), pgaio_method_ops, pgaio_my_backend, pgaio_submit_staged(), and IoMethodOps::wait_on_fd_before_close.
Referenced by CloseTransientFile(), FileClose(), FreeDesc(), and LruDelete().
Definition at line 1081 of file aio.c.
References elog, ERROR, PgAioBackend::in_batchmode, and pgaio_my_backend.
Referenced by batch_start(), read_rel_block_ll(), and read_stream_look_ahead().
Definition at line 1165 of file aio.c.
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().
Definition at line 1092 of file aio.c.
References Assert, PgAioBackend::in_batchmode, pgaio_my_backend, and pgaio_submit_staged().
Referenced by batch_end(), read_rel_block_ll(), and read_stream_look_ahead().
Definition at line 1107 of file aio.c.
References Assert, PgAioBackend::in_batchmode, PgAioBackend::num_staged_ios, and pgaio_my_backend.
Referenced by ReadBuffersCanStartIO().
| PgAioHandle * pgaio_io_acquire | ( | struct ResourceOwnerData * | resowner, |
| PgAioReturn * | ret | ||
| ) |
Definition at line 162 of file aio.c.
References fb(), pgaio_io_acquire_nb(), and pgaio_io_wait_for_free().
Referenced by AsyncReadBuffers(), handle_get(), handle_get_and_error(), handle_get_release(), handle_get_twice(), and read_rel_block_ll().
| PgAioHandle * pgaio_io_acquire_nb | ( | struct ResourceOwnerData * | resowner, |
| PgAioReturn * | ret | ||
| ) |
Definition at line 188 of file aio.c.
References Assert, dclist_container, dclist_is_empty(), dclist_pop_head_node(), elog, ERROR, fb(), PgAioBackend::handed_out_io, HOLD_INTERRUPTS, PgAioBackend::idle_ios, MyProcNumber, PgAioBackend::num_staged_ios, PGAIO_HS_HANDED_OUT, PGAIO_HS_IDLE, pgaio_io_resowner_register(), pgaio_io_update_state(), pgaio_my_backend, PGAIO_RS_UNKNOWN, PGAIO_SUBMIT_BATCH_SIZE, pgaio_submit_staged(), PgAioReturn::result, RESUME_INTERRUPTS, and PgAioResult::status.
Referenced by AsyncReadBuffers(), and pgaio_io_acquire().
|
static |
Definition at line 891 of file aio.c.
References Assert, fb(), PgAioCtl::io_handle_count, PgAioCtl::io_handles, and pgaio_ctl.
Referenced by pgaio_wref_check_done(), and pgaio_wref_wait().
| int pgaio_io_get_id | ( | PgAioHandle * | ioh | ) |
Definition at line 342 of file aio.c.
References Assert, fb(), PgAioCtl::io_handle_count, PgAioCtl::io_handles, and pgaio_ctl.
Referenced by pg_get_aios(), pgaio_io_wait(), pgaio_io_wait_for_free(), and pgaio_worker_submission_queue_insert().
| ProcNumber pgaio_io_get_owner | ( | PgAioHandle * | ioh | ) |
Definition at line 355 of file aio.c.
References fb(), and PgAioHandle::owner_procno.
Referenced by buffer_readv_complete(), and smgr_aio_reopen().
| const char * pgaio_io_get_state_name | ( | PgAioHandle * | ioh | ) |
Definition at line 928 of file aio.c.
References fb(), and pgaio_io_state_get_name().
Referenced by pg_get_aios(), and pgaio_io_wait().
| void pgaio_io_get_wref | ( | PgAioHandle * | ioh, |
| PgAioWaitRef * | iow | ||
| ) |
Definition at line 366 of file aio.c.
References Assert, fb(), PgAioHandle::generation, PgAioCtl::io_handles, pgaio_ctl, PGAIO_HS_DEFINED, PGAIO_HS_HANDED_OUT, and PGAIO_HS_STAGED.
Referenced by AsyncReadBuffers(), buffer_stage_common(), and read_rel_block_ll().
| bool pgaio_io_needs_synchronous_execution | ( | PgAioHandle * | ioh | ) |
Definition at line 483 of file aio.c.
References fb(), IoMethodOps::needs_synchronous_execution, PGAIO_HF_SYNCHRONOUS, and pgaio_method_ops.
Referenced by pgaio_io_stage().
| void pgaio_io_prepare_submit | ( | PgAioHandle * | ioh | ) |
Definition at line 510 of file aio.c.
References dclist_push_tail(), fb(), PgAioBackend::in_flight_ios, 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 528 of file aio.c.
References Assert, ConditionVariableBroadcast(), CritSectionCount, fb(), INJECTION_POINT, MyProcNumber, PGAIO_HS_COMPLETED_IO, PGAIO_HS_COMPLETED_SHARED, PGAIO_HS_SUBMITTED, pgaio_io_call_complete_shared(), pgaio_io_reclaim(), and pgaio_io_update_state().
Referenced by IoWorkerMain(), and pgaio_io_perform_synchronously().
|
static |
Definition at line 675 of file aio.c.
References Assert, dclist_delete_from(), dclist_push_head(), DEBUG4, fb(), HOLD_INTERRUPTS, PgAioBackend::idle_ios, PgAioBackend::in_flight_ios, MyProcNumber, pg_write_barrier, pgaio_debug_io, PGAIO_HS_COMPLETED_LOCAL, PGAIO_HS_COMPLETED_SHARED, PGAIO_HS_HANDED_OUT, PGAIO_HS_IDLE, pgaio_io_call_complete_local(), pgaio_io_update_state(), pgaio_my_backend, PGAIO_OP_INVALID, pgaio_result_status_string(), PGAIO_RS_UNKNOWN, PGAIO_TID_INVALID, ResourceOwnerForgetAioHandle(), and RESUME_INTERRUPTS.
Referenced by pgaio_io_process_completion(), pgaio_io_release(), pgaio_io_release_resowner(), pgaio_io_wait(), pgaio_io_wait_for_free(), and pgaio_wref_check_done().
| void pgaio_io_release | ( | PgAioHandle * | ioh | ) |
Definition at line 240 of file aio.c.
References Assert, elog, ERROR, fb(), PgAioBackend::handed_out_io, PGAIO_HS_HANDED_OUT, pgaio_io_reclaim(), and pgaio_my_backend.
Referenced by AsyncReadBuffers(), handle_get_release(), and handle_release_last().
| void pgaio_io_release_resowner | ( | dlist_node * | ioh_node, |
| bool | on_error | ||
| ) |
Definition at line 266 of file aio.c.
References Assert, dlist_container, elog, ERROR, fb(), PgAioBackend::handed_out_io, HOLD_INTERRUPTS, PGAIO_HS_COMPLETED_IO, PGAIO_HS_COMPLETED_LOCAL, PGAIO_HS_COMPLETED_SHARED, PGAIO_HS_DEFINED, PGAIO_HS_HANDED_OUT, PGAIO_HS_IDLE, PGAIO_HS_STAGED, PGAIO_HS_SUBMITTED, pgaio_io_reclaim(), pgaio_my_backend, pgaio_submit_staged(), ResourceOwnerForgetAioHandle(), RESUME_INTERRUPTS, and WARNING.
Referenced by ResourceOwnerReleaseInternal().
|
static |
Definition at line 409 of file aio.c.
References Assert, fb(), and ResourceOwnerRememberAioHandle().
Referenced by pgaio_io_acquire_nb().
| void pgaio_io_set_flag | ( | PgAioHandle * | ioh, |
| PgAioHandleFlags | flag | ||
| ) |
Definition at line 330 of file aio.c.
References Assert, fb(), flag(), and PGAIO_HS_HANDED_OUT.
Referenced by AsyncReadBuffers(), mdstartreadv(), and read_rel_block_ll().
| void pgaio_io_stage | ( | PgAioHandle * | ioh, |
| PgAioOp | op | ||
| ) |
Definition at line 424 of file aio.c.
References Assert, DEBUG3, fb(), PgAioBackend::handed_out_io, HOLD_INTERRUPTS, PgAioBackend::in_batchmode, PgAioBackend::num_staged_ios, 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(), RESUME_INTERRUPTS, and PgAioBackend::staged_ios.
Referenced by pgaio_io_start_readv(), and pgaio_io_start_writev().
|
static |
Definition at line 908 of file aio.c.
References fb(), and PGAIO_HS_TOSTR_CASE.
Referenced by pgaio_io_get_state_name(), and pgaio_io_update_state().
|
inlinestatic |
Definition at line 386 of file aio.c.
References Assert, DEBUG5, fb(), INTERRUPTS_CAN_BE_PROCESSED, pg_write_barrier, pgaio_debug_io, and pgaio_io_state_get_name().
Referenced by pgaio_io_acquire_nb(), pgaio_io_prepare_submit(), pgaio_io_process_completion(), pgaio_io_reclaim(), and pgaio_io_stage().
|
static |
Definition at line 579 of file aio.c.
References Assert, ConditionVariableCancelSleep(), ConditionVariablePrepareToSleep(), ConditionVariableSleep(), elog, ERROR, fb(), IsUnderPostmaster, MyProcNumber, PANIC, PGAIO_HF_SYNCHRONOUS, PGAIO_HS_COMPLETED_IO, PGAIO_HS_COMPLETED_LOCAL, PGAIO_HS_COMPLETED_SHARED, PGAIO_HS_DEFINED, PGAIO_HS_HANDED_OUT, PGAIO_HS_IDLE, PGAIO_HS_STAGED, PGAIO_HS_SUBMITTED, pgaio_io_get_id(), pgaio_io_get_state_name(), pgaio_io_reclaim(), pgaio_io_was_recycled(), pgaio_method_ops, and IoMethodOps::wait_one.
Referenced by pgaio_closing_fd(), pgaio_io_wait_for_free(), pgaio_shutdown(), and pgaio_wref_wait().
Definition at line 761 of file aio.c.
References dclist_count(), dclist_head_element, dclist_is_empty(), DEBUG2, elog, ereport, errdetail_internal(), errmsg_internal(), ERROR, fb(), i, PgAioBackend::idle_ios, PgAioBackend::in_flight_ios, PgAioBackend::io_handle_off, PgAioCtl::io_handles, io_max_concurrency, PgAioBackend::num_staged_ios, PANIC, pg_read_barrier, pgaio_ctl, pgaio_debug, pgaio_debug_io, PGAIO_HS_COMPLETED_IO, PGAIO_HS_COMPLETED_LOCAL, PGAIO_HS_COMPLETED_SHARED, PGAIO_HS_DEFINED, PGAIO_HS_HANDED_OUT, PGAIO_HS_IDLE, PGAIO_HS_STAGED, PGAIO_HS_SUBMITTED, pgaio_io_get_id(), pgaio_io_reclaim(), pgaio_io_wait(), pgaio_my_backend, and pgaio_submit_staged().
Referenced by pgaio_io_acquire().
| bool pgaio_io_was_recycled | ( | PgAioHandle * | ioh, |
| uint64 | ref_generation, | ||
| PgAioHandleState * | state | ||
| ) |
Definition at line 559 of file aio.c.
References fb(), and pg_read_barrier.
Referenced by pgaio_io_wait(), and pgaio_wref_check_done().
| const char * pgaio_result_status_string | ( | PgAioResultStatus | rs | ) |
Definition at line 934 of file aio.c.
References fb(), 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().
Definition at line 1288 of file aio.c.
References Assert, AtEOXact_Aio(), dclist_count(), dclist_head_element, dclist_is_empty(), DEBUG2, fb(), PgAioBackend::handed_out_io, PgAioBackend::in_flight_ios, pgaio_debug_io, pgaio_io_wait(), and pgaio_my_backend.
Referenced by pgaio_init_backend().
Definition at line 1123 of file aio.c.
References Assert, DEBUG4, END_CRIT_SECTION, fb(), PgAioBackend::num_staged_ios, pgaio_debug, pgaio_method_ops, pgaio_my_backend, PgAioBackend::staged_ios, START_CRIT_SECTION, and IoMethodOps::submit.
Referenced by AsyncReadBuffers(), pgaio_closing_fd(), pgaio_error_cleanup(), pgaio_exit_batchmode(), pgaio_io_acquire_nb(), pgaio_io_release_resowner(), pgaio_io_stage(), pgaio_io_wait_for_free(), and ReadBuffersCanStartIO().
| bool pgaio_wref_check_done | ( | PgAioWaitRef * | iow | ) |
Definition at line 1005 of file aio.c.
References fb(), MyProcNumber, PGAIO_HS_COMPLETED_LOCAL, PGAIO_HS_COMPLETED_SHARED, PGAIO_HS_IDLE, pgaio_io_from_wref(), pgaio_io_reclaim(), and pgaio_io_was_recycled().
Referenced by WaitReadBuffers().
| void pgaio_wref_clear | ( | PgAioWaitRef * | iow | ) |
Definition at line 964 of file aio.c.
References fb(), and PG_UINT32_MAX.
Referenced by AsyncReadBuffers(), BufferManagerShmemInit(), InitLocalBuffers(), StartReadBuffersImpl(), TerminateBufferIO(), and TerminateLocalBufferIO().
| int pgaio_wref_get_id | ( | PgAioWaitRef * | iow | ) |
| bool pgaio_wref_valid | ( | PgAioWaitRef * | iow | ) |
Definition at line 971 of file aio.c.
References fb(), and PG_UINT32_MAX.
Referenced by InvalidateLocalBuffer(), pgaio_wref_get_id(), ProcessReadBuffersResult(), StartLocalBufferIO(), WaitIO(), and WaitReadBuffers().
| void pgaio_wref_wait | ( | PgAioWaitRef * | iow | ) |
Definition at line 991 of file aio.c.
References fb(), pgaio_io_from_wref(), and pgaio_io_wait().
Referenced by InvalidateLocalBuffer(), read_rel_block_ll(), StartLocalBufferIO(), WaitIO(), and WaitReadBuffers().
| StaticAssertDecl | ( | lengthof(io_method_options) | = =lengthof(pgaio_method_ops_table)+1, |
| "io_method_options out of sync with pgaio_method_ops_table" | |||
| ) |
| int io_max_concurrency = -1 |
Definition at line 75 of file aio.c.
Referenced by AioHandleDataShmemSize(), AioHandleIOVShmemSize(), AioHandleShmemSize(), AioShmemInit(), AioShmemSize(), and pgaio_io_wait_for_free().
| int io_method = DEFAULT_IO_METHOD |
Definition at line 74 of file aio.c.
Referenced by pgaio_workers_enabled(), read_stream_begin_impl(), StartReadBuffersImpl(), and WaitReadBuffers().
| const struct config_enum_entry io_method_options[] |
| PgAioCtl* pgaio_ctl |
Definition at line 78 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().
| const IoMethodOps* pgaio_method_ops |
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().
|
static |
Definition at line 84 of file aio.c.
Referenced by assign_io_method().
| PgAioBackend* pgaio_my_backend |
Definition at line 81 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().