107#define BMR_REL(p_rel) ((BufferManagerRelation){.rel = p_rel})
108#define BMR_SMGR(p_smgr, p_relpersistence) ((BufferManagerRelation){.smgr = p_smgr, .relpersistence = p_relpersistence})
111#define READ_BUFFERS_ZERO_ON_ERROR (1 << 0)
113#define READ_BUFFERS_ISSUE_ADVICE (1 << 1)
155#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 1
156#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 10
158#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 0
159#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 0
164#define MAX_IO_COMBINE_LIMIT PG_IOV_MAX
165#define DEFAULT_IO_COMBINE_LIMIT Min(MAX_IO_COMBINE_LIMIT, (128 * 1024) / BLCKSZ)
181#define MAX_IO_CONCURRENCY 1000
184#define P_NEW InvalidBlockNumber
189#define BUFFER_LOCK_UNLOCK 0
190#define BUFFER_LOCK_SHARE 1
191#define BUFFER_LOCK_EXCLUSIVE 2
273#define RelationGetNumberOfBlocks(reln) \
274 RelationGetNumberOfBlocksInFork(reln, MAIN_FORKNUM)
280extern void PrintPinnedBufs(
void);
392 return (
Size) BLCKSZ;
#define BufferIsLocal(buffer)
void CheckBufferIsPinnedOnce(Buffer buffer)
struct BufferManagerRelation BufferManagerRelation
void IncrBufferRefCount(Buffer buffer)
void DropDatabaseBuffers(Oid dbid)
bool BgBufferSync(struct WritebackContext *wb_context)
PGDLLIMPORT int effective_io_concurrency
bool BufferIsExclusiveLocked(Buffer buffer)
BlockNumber BufferGetBlockNumber(Buffer buffer)
void DropRelationBuffers(struct SMgrRelationData *smgr_reln, ForkNumber *forkNum, int nforks, BlockNumber *firstDelBlock)
Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation, BlockNumber blockNum)
PrefetchBufferResult PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum)
int GetAccessStrategyPinLimit(BufferAccessStrategy strategy)
bool StartReadBuffers(ReadBuffersOperation *operation, Buffer *buffers, BlockNumber blockNum, int *nblocks, int flags)
PGDLLIMPORT int bgwriter_flush_after
PGDLLIMPORT bool zero_damaged_pages
PGDLLIMPORT Block * LocalBufferBlockPointers
bool IsBufferCleanupOK(Buffer buffer)
PGDLLIMPORT int bgwriter_lru_maxpages
Buffer ExtendBufferedRel(BufferManagerRelation bmr, ForkNumber forkNum, BufferAccessStrategy strategy, uint32 flags)
static Page BufferGetPage(Buffer buffer)
void AtEOXact_Buffers(bool isCommit)
BufferAccessStrategy GetAccessStrategy(BufferAccessStrategyType btype)
BlockNumber ExtendBufferedRelBy(BufferManagerRelation bmr, ForkNumber fork, BufferAccessStrategy strategy, uint32 flags, uint32 extend_by, Buffer *buffers, uint32 *extended_by)
struct PrefetchBufferResult PrefetchBufferResult
Size BufferManagerShmemSize(void)
static Block BufferGetBlock(Buffer buffer)
void CreateAndCopyRelationData(RelFileLocator src_rlocator, RelFileLocator dst_rlocator, bool permanent)
PGDLLIMPORT int maintenance_io_concurrency
Buffer ExtendBufferedRelTo(BufferManagerRelation bmr, ForkNumber fork, BufferAccessStrategy strategy, uint32 flags, BlockNumber extend_to, ReadBufferMode mode)
void AtProcExit_LocalBuffers(void)
PGDLLIMPORT bool track_io_timing
void BufferGetTag(Buffer buffer, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum)
void LimitAdditionalLocalPins(uint32 *additional_pins)
BufferAccessStrategy GetAccessStrategyWithSize(BufferAccessStrategyType btype, int ring_size_kb)
char * DebugPrintBufferRefcount(Buffer buffer)
void CheckPointBuffers(int flags)
bool BufferIsDirty(Buffer buffer)
void DropRelationsAllBuffers(struct SMgrRelationData **smgr_reln, int nlocators)
bool BufferIsPermanent(Buffer buffer)
int GetAccessStrategyBufferCount(BufferAccessStrategy strategy)
static Size BufferGetPageSize(Buffer buffer)
bool ConditionalLockBuffer(Buffer buffer)
BlockNumber RelationGetNumberOfBlocksInFork(Relation relation, ForkNumber forkNum)
void BufferManagerShmemInit(void)
void ReleaseBuffer(Buffer buffer)
void FreeAccessStrategy(BufferAccessStrategy strategy)
PGDLLIMPORT int32 * LocalRefCount
XLogRecPtr BufferGetLSNAtomic(Buffer buffer)
bool HoldingBufferPinThatDelaysRecovery(void)
void UnlockReleaseBuffer(Buffer buffer)
void WaitReadBuffers(ReadBuffersOperation *operation)
PrefetchBufferResult PrefetchSharedBuffer(struct SMgrRelationData *smgr_reln, ForkNumber forkNum, BlockNumber blockNum)
void MarkBufferDirty(Buffer buffer)
PGDLLIMPORT int io_combine_limit
void LimitAdditionalPins(uint32 *additional_pins)
PGDLLIMPORT int NLocBuffer
void LockBufferForCleanup(Buffer buffer)
void LockBuffer(Buffer buffer, int mode)
void MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
void FlushRelationBuffers(Relation rel)
@ EB_CREATE_FORK_IF_NEEDED
Buffer ReadBufferWithoutRelcache(RelFileLocator rlocator, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy, bool permanent)
PGDLLIMPORT int backend_flush_after
PGDLLIMPORT double bgwriter_lru_multiplier
bool ReadRecentBuffer(RelFileLocator rlocator, ForkNumber forkNum, BlockNumber blockNum, Buffer recent_buffer)
void FlushDatabaseBuffers(Oid dbid)
void FlushRelationsAllBuffers(struct SMgrRelationData **smgrs, int nrels)
bool EvictUnpinnedBuffer(Buffer buf)
PGDLLIMPORT int checkpoint_flush_after
bool StartReadBuffer(ReadBuffersOperation *operation, Buffer *buffer, BlockNumber blocknum, int flags)
Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy)
void InitBufferManagerAccess(void)
PGDLLIMPORT char * BufferBlocks
Buffer ReadBuffer(Relation reln, BlockNumber blockNum)
@ RBM_ZERO_AND_CLEANUP_LOCK
bool ConditionalLockBufferForCleanup(Buffer buffer)
void FlushOneBuffer(Buffer buffer)
static bool BufferIsValid(Buffer bufnum)
#define AssertMacro(condition)
#define Assert(condition)
static PgChecksumMode mode
struct SMgrRelationData * smgr
BufferAccessStrategy strategy
struct SMgrRelationData * smgr