PostgreSQL Source Code git master
|
#include "postgres.h"
#include "libpq/pqsignal.h"
#include "miscadmin.h"
#include "port/pg_bitutils.h"
#include "postmaster/auxprocess.h"
#include "postmaster/interrupt.h"
#include "storage/aio.h"
#include "storage/aio_internal.h"
#include "storage/aio_subsys.h"
#include "storage/io_worker.h"
#include "storage/ipc.h"
#include "storage/latch.h"
#include "storage/proc.h"
#include "tcop/tcopprot.h"
#include "utils/ps_status.h"
#include "utils/wait_event.h"
Go to the source code of this file.
Data Structures | |
struct | AioWorkerSubmissionQueue |
struct | AioWorkerSlot |
struct | AioWorkerControl |
Macros | |
#define | IO_WORKER_WAKEUP_FANOUT 2 |
Typedefs | |
typedef struct AioWorkerSubmissionQueue | AioWorkerSubmissionQueue |
typedef struct AioWorkerSlot | AioWorkerSlot |
typedef struct AioWorkerControl | AioWorkerControl |
Functions | |
static size_t | pgaio_worker_shmem_size (void) |
static void | pgaio_worker_shmem_init (bool first_time) |
static bool | pgaio_worker_needs_synchronous_execution (PgAioHandle *ioh) |
static int | pgaio_worker_submit (uint16 num_staged_ios, PgAioHandle **staged_ios) |
static size_t | pgaio_worker_queue_shmem_size (int *queue_size) |
static size_t | pgaio_worker_control_shmem_size (void) |
static int | pgaio_choose_idle_worker (void) |
static bool | pgaio_worker_submission_queue_insert (PgAioHandle *ioh) |
static uint32 | pgaio_worker_submission_queue_consume (void) |
static uint32 | pgaio_worker_submission_queue_depth (void) |
static void | pgaio_worker_submit_internal (int nios, PgAioHandle *ios[]) |
static void | pgaio_worker_die (int code, Datum arg) |
static void | pgaio_worker_register (void) |
void | IoWorkerMain (const void *startup_data, size_t startup_data_len) |
bool | pgaio_workers_enabled (void) |
Variables | |
const IoMethodOps | pgaio_worker_ops |
int | io_workers = 3 |
static int | io_worker_queue_size = 64 |
static int | MyIoWorkerId |
static AioWorkerSubmissionQueue * | io_worker_submission_queue |
static AioWorkerControl * | io_worker_control |
#define IO_WORKER_WAKEUP_FANOUT 2 |
Definition at line 50 of file method_worker.c.
typedef struct AioWorkerControl AioWorkerControl |
typedef struct AioWorkerSlot AioWorkerSlot |
typedef struct AioWorkerSubmissionQueue AioWorkerSubmissionQueue |
void IoWorkerMain | ( | const void * | startup_data, |
size_t | startup_data_len | ||
) |
Definition at line 361 of file method_worker.c.
References Assert(), AuxiliaryProcessMainCommon(), B_IO_WORKER, CHECK_FOR_INTERRUPTS, DEBUG4, die, EmitErrorReport(), END_CRIT_SECTION, error_context_stack, HOLD_INTERRUPTS, i, AioWorkerControl::idle_worker_mask, PgAioCtl::io_handles, io_worker_control, IO_WORKER_WAKEUP_FANOUT, AioWorkerSlot::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), LWLockReleaseAll(), Min, MyBackendType, MyIoWorkerId, MyLatch, PG_exception_stack, pgaio_choose_idle_worker(), pgaio_ctl, pgaio_debug_io, pgaio_io_call_inj, pgaio_io_perform_synchronously(), pgaio_io_process_completion(), pgaio_io_reopen(), pgaio_worker_register(), pgaio_worker_submission_queue_consume(), pgaio_worker_submission_queue_depth(), pqsignal, proc_exit(), procsignal_sigusr1_handler(), ResetLatch(), RESUME_INTERRUPTS, set_ps_display(), SetLatch(), ShutdownRequestPending, SIGALRM, SIGHUP, SignalHandlerForConfigReload(), SignalHandlerForShutdownRequest(), SIGPIPE, SIGUSR1, SIGUSR2, sprintf, START_CRIT_SECTION, UnBlockSig, WaitLatch(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, and AioWorkerControl::workers.
|
static |
Definition at line 163 of file method_worker.c.
References AioWorkerControl::idle_worker_mask, io_worker_control, and pg_rightmost_one_pos64().
Referenced by IoWorkerMain(), and pgaio_worker_submit_internal().
|
static |
Definition at line 112 of file method_worker.c.
References MAX_IO_WORKERS.
Referenced by pgaio_worker_shmem_init(), and pgaio_worker_shmem_size().
|
static |
Definition at line 311 of file method_worker.c.
References Assert(), AioWorkerSlot::in_use, io_worker_control, AioWorkerSlot::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyIoWorkerId, MyLatch, and AioWorkerControl::workers.
Referenced by pgaio_worker_register().
|
static |
Definition at line 232 of file method_worker.c.
References PgAioHandle::flags, IsUnderPostmaster, PGAIO_HF_REFERENCES_LOCAL, and pgaio_io_can_reopen().
Referenced by pgaio_worker_submit_internal().
|
static |
Definition at line 102 of file method_worker.c.
References io_worker_queue_size, and pg_nextpower2_32().
Referenced by pgaio_worker_shmem_init(), and pgaio_worker_shmem_size().
|
static |
Definition at line 327 of file method_worker.c.
References Assert(), elog, ERROR, i, AioWorkerControl::idle_worker_mask, AioWorkerSlot::in_use, io_worker_control, AioWorkerSlot::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MAX_IO_WORKERS, MyIoWorkerId, MyLatch, on_shmem_exit(), pgaio_worker_die(), and AioWorkerControl::workers.
Referenced by IoWorkerMain().
|
static |
Definition at line 131 of file method_worker.c.
References AioWorkerSubmissionQueue::head, i, AioWorkerControl::idle_worker_mask, AioWorkerSlot::in_use, io_worker_control, io_worker_submission_queue, AioWorkerSlot::latch, MAX_IO_WORKERS, pgaio_worker_control_shmem_size(), pgaio_worker_queue_shmem_size(), ShmemInitStruct(), AioWorkerSubmissionQueue::size, AioWorkerSubmissionQueue::tail, and AioWorkerControl::workers.
|
static |
Definition at line 119 of file method_worker.c.
References add_size(), pgaio_worker_control_shmem_size(), and pgaio_worker_queue_shmem_size().
|
static |
Definition at line 199 of file method_worker.c.
References AioWorkerSubmissionQueue::head, io_worker_submission_queue, AioWorkerSubmissionQueue::ios, AioWorkerSubmissionQueue::size, and AioWorkerSubmissionQueue::tail.
Referenced by IoWorkerMain().
|
static |
Definition at line 215 of file method_worker.c.
References Assert(), AioWorkerSubmissionQueue::head, io_worker_submission_queue, AioWorkerSubmissionQueue::size, and AioWorkerSubmissionQueue::tail.
Referenced by IoWorkerMain().
|
static |
Definition at line 178 of file method_worker.c.
References DEBUG3, AioWorkerSubmissionQueue::head, io_worker_submission_queue, AioWorkerSubmissionQueue::ios, pgaio_debug, pgaio_io_get_id(), AioWorkerSubmissionQueue::size, and AioWorkerSubmissionQueue::tail.
Referenced by pgaio_worker_submit_internal().
|
static |
Definition at line 292 of file method_worker.c.
References i, pgaio_io_prepare_submit(), and pgaio_worker_submit_internal().
|
static |
Definition at line 241 of file method_worker.c.
References Assert(), DEBUG4, i, io_worker_control, AioWorkerSlot::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), pgaio_choose_idle_worker(), pgaio_debug_io, pgaio_io_perform_synchronously(), PGAIO_SUBMIT_BATCH_SIZE, pgaio_worker_needs_synchronous_execution(), pgaio_worker_submission_queue_insert(), SetLatch(), wakeup, and AioWorkerControl::workers.
Referenced by pgaio_worker_submit().
bool pgaio_workers_enabled | ( | void | ) |
Definition at line 529 of file method_worker.c.
References io_method, and IOMETHOD_WORKER.
Referenced by maybe_adjust_io_workers().
|
static |
Definition at line 98 of file method_worker.c.
Referenced by IoWorkerMain(), pgaio_choose_idle_worker(), pgaio_worker_die(), pgaio_worker_register(), pgaio_worker_shmem_init(), and pgaio_worker_submit_internal().
|
static |
Definition at line 95 of file method_worker.c.
Referenced by pgaio_worker_queue_shmem_size().
|
static |
Definition at line 97 of file method_worker.c.
Referenced by pgaio_worker_shmem_init(), pgaio_worker_submission_queue_consume(), pgaio_worker_submission_queue_depth(), and pgaio_worker_submission_queue_insert().
int io_workers = 3 |
Definition at line 92 of file method_worker.c.
Referenced by maybe_adjust_io_workers().
|
static |
Definition at line 96 of file method_worker.c.
Referenced by IoWorkerMain(), pgaio_worker_die(), and pgaio_worker_register().
const IoMethodOps pgaio_worker_ops |
Definition at line 82 of file method_worker.c.