PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/xlogutils.h"
#include "lib/ilist.h"
#include "storage/bufmgr.h"
#include "storage/ipc.h"
#include "storage/md.h"
#include "storage/smgr.h"
#include "utils/hsearch.h"
#include "utils/inval.h"
Go to the source code of this file.
Data Structures | |
struct | f_smgr |
Typedefs | |
typedef struct f_smgr | f_smgr |
Variables | |
static const f_smgr | smgrsw [] |
static const int | NSmgr = lengthof(smgrsw) |
static HTAB * | SMgrRelationHash = NULL |
static dlist_head | unpinned_relns |
void AtEOXact_SMgr | ( | void | ) |
Definition at line 829 of file smgr.c.
References smgrdestroyall().
Referenced by AbortTransaction(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), PrepareTransaction(), and WalWriterMain().
bool ProcessBarrierSmgrRelease | ( | void | ) |
Definition at line 839 of file smgr.c.
References smgrreleaseall().
Referenced by ProcessProcSignalBarrier().
void smgrclose | ( | SMgrRelation | reln | ) |
Definition at line 323 of file smgr.c.
References smgrrelease().
Referenced by DropRelationFiles(), fill_seq_with_data(), heapam_relation_copy_data(), heapam_relation_set_new_filelocator(), index_copy_data(), RelationCloseSmgr(), RelationSetNewRelfilenumber(), ScanSourceDatabasePgClass(), and smgrDoPendingDeletes().
void smgrcreate | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
bool | isRedo | ||
) |
Definition at line 414 of file smgr.c.
References f_smgr::smgr_create, SMgrRelationData::smgr_which, and smgrsw.
Referenced by CreateAndCopyRelationData(), ExtendBufferedRelTo(), fill_seq_with_data(), heapam_relation_copy_data(), heapam_relation_set_new_filelocator(), index_build(), index_copy_data(), RelationCreateStorage(), smgr_redo(), and XLogReadBufferExtended().
|
static |
Definition at line 280 of file smgr.c.
References Assert, dlist_delete(), elog, ERROR, HASH_REMOVE, hash_search(), MAX_FORKNUM, SMgrRelationData::node, SMgrRelationData::pincount, f_smgr::smgr_close, SMgrRelationData::smgr_rlocator, SMgrRelationData::smgr_which, SMgrRelationHash, and smgrsw.
Referenced by smgrdestroyall().
void smgrdestroyall | ( | void | ) |
Definition at line 335 of file smgr.c.
References dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, smgrdestroy(), and unpinned_relns.
Referenced by AtEOXact_SMgr(), BackgroundWriterMain(), CheckpointerMain(), RequestCheckpoint(), and XLogDropDatabase().
void smgrdosyncall | ( | SMgrRelation * | rels, |
int | nrels | ||
) |
Definition at line 429 of file smgr.c.
References FlushRelationsAllBuffers(), i, MAX_FORKNUM, f_smgr::smgr_immedsync, SMgrRelationData::smgr_which, and smgrsw.
Referenced by smgrDoPendingSyncs().
void smgrdounlinkall | ( | SMgrRelation * | rels, |
int | nrels, | ||
bool | isRedo | ||
) |
Definition at line 465 of file smgr.c.
References CacheInvalidateSmgr(), DropRelationsAllBuffers(), i, MAX_FORKNUM, palloc(), pfree(), SMgrRelationData::smgr_rlocator, SMgrRelationData::smgr_which, and smgrsw.
Referenced by DropRelationFiles(), RelationSetNewRelfilenumber(), and smgrDoPendingDeletes().
bool smgrexists | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 401 of file smgr.c.
References f_smgr::smgr_exists, SMgrRelationData::smgr_which, and smgrsw.
Referenced by autoprewarm_database_main(), bt_index_check_internal(), CreateAndCopyRelationData(), DropRelationsAllBuffers(), ExtendBufferedRelTo(), FreeSpaceMapPrepareTruncateRel(), fsm_readbuf(), heapam_relation_copy_data(), index_build(), index_copy_data(), pg_prewarm(), RelationTruncate(), smgr_redo(), smgrDoPendingSyncs(), visibilitymap_prepare_truncate(), vm_readbuf(), and XLogPrefetcherNextBlock().
void smgrextend | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
const void * | buffer, | ||
bool | skipFsync | ||
) |
Definition at line 538 of file smgr.c.
References InvalidBlockNumber, SMgrRelationData::smgr_cached_nblocks, f_smgr::smgr_extend, SMgrRelationData::smgr_which, and smgrsw.
Referenced by _hash_alloc_buckets(), RelationCopyStorageUsingBuffer(), and smgr_bulk_flush().
void smgrimmedsync | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 811 of file smgr.c.
References f_smgr::smgr_immedsync, SMgrRelationData::smgr_which, and smgrsw.
Referenced by smgr_bulk_finish().
void smgrinit | ( | void | ) |
Definition at line 157 of file smgr.c.
References i, NSmgr, on_proc_exit(), f_smgr::smgr_init, smgrshutdown(), and smgrsw.
Referenced by BaseInit().
uint32 smgrmaxcombine | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum | ||
) |
Definition at line 601 of file smgr.c.
References f_smgr::smgr_maxcombine, SMgrRelationData::smgr_which, and smgrsw.
Referenced by StartReadBuffersImpl().
BlockNumber smgrnblocks | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 677 of file smgr.c.
References InvalidBlockNumber, SMgrRelationData::smgr_cached_nblocks, f_smgr::smgr_nblocks, SMgrRelationData::smgr_which, smgrnblocks_cached(), and smgrsw.
Referenced by ExtendBufferedRelLocal(), ExtendBufferedRelShared(), ExtendBufferedRelTo(), FreeSpaceMapPrepareTruncateRel(), fsm_readbuf(), gistBuildCallback(), RelationCopyStorage(), RelationCopyStorageUsingBuffer(), RelationGetNumberOfBlocksInFork(), ScanSourceDatabasePgClass(), smgr_bulk_start_smgr(), smgrDoPendingSyncs(), table_block_relation_size(), visibilitymap_prepare_truncate(), vm_readbuf(), XLogPrefetcherNextBlock(), and XLogReadBufferExtended().
BlockNumber smgrnblocks_cached | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 701 of file smgr.c.
References InRecovery, InvalidBlockNumber, and SMgrRelationData::smgr_cached_nblocks.
Referenced by DropRelationBuffers(), DropRelationsAllBuffers(), and smgrnblocks().
SMgrRelation smgropen | ( | RelFileLocator | rlocator, |
ProcNumber | backend | ||
) |
Definition at line 201 of file smgr.c.
References Assert, RelFileLocatorBackend::backend, ctl, dlist_init(), dlist_push_tail(), HASH_BLOBS, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), i, InvalidBlockNumber, RelFileLocatorBackend::locator, MAX_FORKNUM, SMgrRelationData::node, SMgrRelationData::pincount, RelFileNumberIsValid, RelFileLocator::relNumber, SMgrRelationData::smgr_cached_nblocks, f_smgr::smgr_open, SMgrRelationData::smgr_targblock, SMgrRelationData::smgr_which, SMgrRelationHash, smgrsw, and unpinned_relns.
Referenced by CreateAndCopyRelationData(), CreateFakeRelcacheEntry(), DropRelationFiles(), fill_seq_with_data(), FlushBuffer(), GetLocalVictimBuffer(), IssuePendingWritebacks(), mdsyncfiletag(), ReadBufferWithoutRelcache(), RelationCopyStorageUsingBuffer(), RelationCreateStorage(), RelationGetSmgr(), RelationSetNewRelfilenumber(), ScanSourceDatabasePgClass(), smgr_redo(), smgrDoPendingDeletes(), smgrDoPendingSyncs(), XLogPrefetcherNextBlock(), and XLogReadBufferExtended().
void smgrpin | ( | SMgrRelation | reln | ) |
Definition at line 253 of file smgr.c.
References dlist_delete(), SMgrRelationData::node, and SMgrRelationData::pincount.
Referenced by RelationGetSmgr().
bool smgrprefetch | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
int | nblocks | ||
) |
Definition at line 588 of file smgr.c.
References f_smgr::smgr_prefetch, SMgrRelationData::smgr_which, and smgrsw.
Referenced by PrefetchLocalBuffer(), PrefetchSharedBuffer(), and StartReadBuffersImpl().
void smgrreadv | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
void ** | buffers, | ||
BlockNumber | nblocks | ||
) |
Definition at line 619 of file smgr.c.
References f_smgr::smgr_readv, SMgrRelationData::smgr_which, and smgrsw.
Referenced by smgrread(), and WaitReadBuffers().
void smgrregistersync | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 779 of file smgr.c.
References f_smgr::smgr_registersync, SMgrRelationData::smgr_which, and smgrsw.
Referenced by smgr_bulk_finish().
void smgrrelease | ( | SMgrRelation | reln | ) |
Definition at line 303 of file smgr.c.
References InvalidBlockNumber, MAX_FORKNUM, SMgrRelationData::smgr_cached_nblocks, f_smgr::smgr_close, SMgrRelationData::smgr_targblock, SMgrRelationData::smgr_which, and smgrsw.
Referenced by smgrclose(), smgrreleaseall(), and smgrreleaserellocator().
void smgrreleaseall | ( | void | ) |
Definition at line 356 of file smgr.c.
References hash_seq_init(), hash_seq_search(), SMgrRelationHash, and smgrrelease().
Referenced by ProcessBarrierSmgrRelease(), and RelationCacheInvalidate().
void smgrreleaserellocator | ( | RelFileLocatorBackend | rlocator | ) |
Definition at line 382 of file smgr.c.
References HASH_FIND, hash_search(), SMgrRelationHash, and smgrrelease().
Referenced by LocalExecuteInvalidationMessage().
|
static |
Definition at line 175 of file smgr.c.
References i, NSmgr, f_smgr::smgr_shutdown, and smgrsw.
Referenced by smgrinit().
void smgrtruncate | ( | SMgrRelation | reln, |
ForkNumber * | forknum, | ||
int | nforks, | ||
BlockNumber * | nblocks | ||
) |
Definition at line 725 of file smgr.c.
References CacheInvalidateSmgr(), DropRelationBuffers(), i, InvalidBlockNumber, SMgrRelationData::smgr_cached_nblocks, SMgrRelationData::smgr_rlocator, f_smgr::smgr_truncate, SMgrRelationData::smgr_which, and smgrsw.
Referenced by pg_truncate_visibility_map(), RelationTruncate(), and smgr_redo().
void smgrunpin | ( | SMgrRelation | reln | ) |
Definition at line 268 of file smgr.c.
References Assert, dlist_push_tail(), SMgrRelationData::node, SMgrRelationData::pincount, and unpinned_relns.
Referenced by RelationCloseSmgr().
void smgrwriteback | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
BlockNumber | nblocks | ||
) |
Definition at line 665 of file smgr.c.
References SMgrRelationData::smgr_which, f_smgr::smgr_writeback, and smgrsw.
Referenced by IssuePendingWritebacks().
void smgrwritev | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
const void ** | buffers, | ||
BlockNumber | nblocks, | ||
bool | skipFsync | ||
) |
Definition at line 653 of file smgr.c.
References SMgrRelationData::smgr_which, f_smgr::smgr_writev, and smgrsw.
Referenced by smgrwrite().
void smgrzeroextend | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
int | nblocks, | ||
bool | skipFsync | ||
) |
Definition at line 563 of file smgr.c.
References InvalidBlockNumber, SMgrRelationData::smgr_cached_nblocks, SMgrRelationData::smgr_which, f_smgr::smgr_zeroextend, and smgrsw.
Referenced by ExtendBufferedRelLocal(), and ExtendBufferedRelShared().
Definition at line 133 of file smgr.c.
Referenced by smgrinit(), and smgrshutdown().
|
static |
Definition at line 139 of file smgr.c.
Referenced by smgrdestroy(), smgropen(), smgrreleaseall(), and smgrreleaserellocator().
|
static |
Definition at line 109 of file smgr.c.
Referenced by smgrcreate(), smgrdestroy(), smgrdosyncall(), smgrdounlinkall(), smgrexists(), smgrextend(), smgrimmedsync(), smgrinit(), smgrmaxcombine(), smgrnblocks(), smgropen(), smgrprefetch(), smgrreadv(), smgrregistersync(), smgrrelease(), smgrshutdown(), smgrtruncate(), smgrwriteback(), smgrwritev(), and smgrzeroextend().
|
static |
Definition at line 141 of file smgr.c.
Referenced by smgrdestroyall(), smgropen(), and smgrunpin().