|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "pgstat.h"#include "port/atomics.h"#include "storage/buf_internals.h"#include "storage/bufmgr.h"#include "storage/proc.h"#include "storage/shmem.h"#include "storage/subsystems.h"
Go to the source code of this file.
Data Structures | |
| struct | BufferStrategyControl |
| struct | BufferAccessStrategyData |
Macros | |
| #define | INT_ACCESS_ONCE(var) ((int)(*((volatile int *)&(var)))) |
Typedefs | |
| typedef struct BufferAccessStrategyData | BufferAccessStrategyData |
Variables | |
| static BufferStrategyControl * | StrategyControl = NULL |
| const ShmemCallbacks | StrategyCtlShmemCallbacks |
Definition at line 26 of file freelist.c.
|
static |
Definition at line 702 of file freelist.c.
References buf, BufferDescriptorGetBuffer(), BufferAccessStrategyData::buffers, and BufferAccessStrategyData::current.
Referenced by StrategyGetBuffer().
Definition at line 110 of file freelist.c.
References BufferStrategyControl::buffer_strategy_lock, BufferStrategyControl::completePasses, fb(), NBuffers, BufferStrategyControl::nextVictimBuffer, pg_atomic_compare_exchange_u32(), pg_atomic_fetch_add_u32(), SpinLockAcquire(), SpinLockRelease(), StrategyControl, and success.
Referenced by StrategyGetBuffer().
| void FreeAccessStrategy | ( | BufferAccessStrategy | strategy | ) |
Definition at line 608 of file freelist.c.
Referenced by blgetbitmap(), FreeBulkInsertState(), heap_endscan(), initscan(), parallel_vacuum_main(), and RelationCopyStorageUsingBuffer().
| BufferAccessStrategy GetAccessStrategy | ( | BufferAccessStrategyType | btype | ) |
Definition at line 426 of file freelist.c.
References BAS_BULKREAD, BAS_BULKWRITE, BAS_NORMAL, BAS_VACUUM, effective_io_concurrency, elog, ERROR, fb(), GetAccessStrategyWithSize(), GetPinLimit(), io_combine_limit, and Max.
Referenced by blgetbitmap(), bt_check_every_level(), collect_corrupt_items(), collect_visibility_data(), DataChecksumsWorkerMain(), GetBulkInsertState(), gin_check_parent_keys_consistency(), gin_check_posting_tree_parent_keys_consistency(), initscan(), pgstat_index(), pgstathashindex(), pgstatindex_impl(), RelationCopyStorageUsingBuffer(), ScanSourceDatabasePgClass(), statapprox_heap(), and verify_heapam().
| int GetAccessStrategyBufferCount | ( | BufferAccessStrategy | strategy | ) |
Definition at line 551 of file freelist.c.
References fb(), and BufferAccessStrategyData::nbuffers.
Referenced by parallel_vacuum_init().
| int GetAccessStrategyPinLimit | ( | BufferAccessStrategy | strategy | ) |
Definition at line 574 of file freelist.c.
References BAS_BULKREAD, BufferAccessStrategyData::btype, fb(), BufferAccessStrategyData::nbuffers, and NBuffers.
Referenced by read_stream_begin_impl().
| BufferAccessStrategy GetAccessStrategyWithSize | ( | BufferAccessStrategyType | btype, |
| int | ring_size_kb | ||
| ) |
Definition at line 511 of file freelist.c.
References Assert, BufferAccessStrategyData::btype, fb(), Min, BufferAccessStrategyData::nbuffers, NBuffers, and palloc0().
Referenced by do_autovacuum(), ExecVacuum(), GetAccessStrategy(), and parallel_vacuum_main().
|
static |
Definition at line 623 of file freelist.c.
References BM_LOCKED, buf, BUF_REFCOUNT_ONE, BUF_STATE_GET_REFCOUNT, BUF_STATE_GET_USAGECOUNT, BufferDescriptorGetBuffer(), BufferAccessStrategyData::buffers, BufferAccessStrategyData::current, fb(), GetBufferDescriptor(), InvalidBuffer, BufferAccessStrategyData::nbuffers, pg_atomic_compare_exchange_u64(), pg_atomic_read_u64(), TrackNewBufferPin(), unlikely, and WaitBufHdrUnlocked().
Referenced by StrategyGetBuffer().
| IOContext IOContextForStrategy | ( | BufferAccessStrategy | strategy | ) |
Definition at line 712 of file freelist.c.
References BAS_BULKREAD, BAS_BULKWRITE, BAS_NORMAL, BAS_VACUUM, BufferAccessStrategyData::btype, elog, ERROR, IOCONTEXT_BULKREAD, IOCONTEXT_BULKWRITE, IOCONTEXT_NORMAL, IOCONTEXT_VACUUM, and pg_unreachable.
Referenced by AsyncReadBuffers(), ExtendBufferedRelShared(), ReadBuffer_common(), StartReadBuffersImpl(), and WaitReadBuffers().
Definition at line 398 of file freelist.c.
References BufferStrategyControl::bgwprocno, BufferStrategyControl::buffer_strategy_lock, BufferStrategyControl::completePasses, BufferStrategyControl::nextVictimBuffer, BufferStrategyControl::numBufferAllocs, pg_atomic_init_u32(), SpinLockInit(), and StrategyControl.
Definition at line 386 of file freelist.c.
References name, ShmemRequestStruct, and StrategyControl.
| BufferDesc * StrategyGetBuffer | ( | BufferAccessStrategy | strategy, |
| uint64 * | buf_state, | ||
| bool * | from_ring | ||
| ) |
Definition at line 184 of file freelist.c.
References AddBufferToRing(), BufferStrategyControl::bgwprocno, BM_LOCKED, buf, BUF_REFCOUNT_ONE, BUF_STATE_GET_REFCOUNT, BUF_STATE_GET_USAGECOUNT, BUF_USAGECOUNT_ONE, BufferDescriptorGetBuffer(), ClockSweepTick(), elog, ERROR, fb(), GetBufferDescriptor(), GetBufferFromRing(), GetPGProcByNumber, INT_ACCESS_ONCE, NBuffers, BufferStrategyControl::numBufferAllocs, pg_atomic_compare_exchange_u64(), pg_atomic_fetch_add_u32(), pg_atomic_read_u64(), SetLatch(), StrategyControl, TrackNewBufferPin(), unlikely, and WaitBufHdrUnlocked().
Referenced by GetVictimBuffer().
Definition at line 368 of file freelist.c.
References BufferStrategyControl::bgwprocno, BufferStrategyControl::buffer_strategy_lock, SpinLockAcquire(), SpinLockRelease(), and StrategyControl.
Referenced by BackgroundWriterMain().
| bool StrategyRejectBuffer | ( | BufferAccessStrategy | strategy, |
| BufferDesc * | buf, | ||
| bool | from_ring | ||
| ) |
Definition at line 752 of file freelist.c.
References BAS_BULKREAD, BufferAccessStrategyData::btype, buf, BufferDescriptorGetBuffer(), BufferAccessStrategyData::buffers, BufferAccessStrategyData::current, fb(), and InvalidBuffer.
Referenced by GetVictimBuffer().
Definition at line 331 of file freelist.c.
References BufferStrategyControl::buffer_strategy_lock, BufferStrategyControl::completePasses, fb(), NBuffers, BufferStrategyControl::nextVictimBuffer, BufferStrategyControl::numBufferAllocs, pg_atomic_exchange_u32(), pg_atomic_read_u32(), result, SpinLockAcquire(), SpinLockRelease(), and StrategyControl.
Referenced by BgBufferSync().
|
static |
Definition at line 59 of file freelist.c.
Referenced by ClockSweepTick(), StrategyCtlShmemInit(), StrategyCtlShmemRequest(), StrategyGetBuffer(), StrategyNotifyBgWriter(), and StrategySyncStart().
| const ShmemCallbacks StrategyCtlShmemCallbacks |
Definition at line 64 of file freelist.c.