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 | unowned_relns |
void AtEOXact_SMgr | ( | void | ) |
Definition at line 709 of file smgr.c.
References Assert(), dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, SMgrRelationData::smgr_owner, smgrclose(), and unowned_relns.
Referenced by AbortTransaction(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), PrepareTransaction(), and WalWriterMain().
bool ProcessBarrierSmgrRelease | ( | void | ) |
Definition at line 733 of file smgr.c.
References smgrreleaseall().
Referenced by ProcessProcSignalBarrier().
void smgrclearowner | ( | SMgrRelation * | owner, |
SMgrRelation | reln | ||
) |
Definition at line 227 of file smgr.c.
References dlist_push_tail(), SMgrRelationData::node, SMgrRelationData::smgr_owner, and unowned_relns.
Referenced by FreeFakeRelcacheEntry().
void smgrclose | ( | SMgrRelation | reln | ) |
Definition at line 256 of file smgr.c.
References dlist_delete(), elog(), ERROR, HASH_REMOVE, hash_search(), MAX_FORKNUM, SMgrRelationData::node, f_smgr::smgr_close, SMgrRelationData::smgr_owner, SMgrRelationData::smgr_rlocator, SMgrRelationData::smgr_which, SMgrRelationHash, and smgrsw.
Referenced by AtEOXact_SMgr(), DropRelationFiles(), fill_seq_with_data(), heapam_relation_copy_data(), heapam_relation_set_new_filelocator(), index_copy_data(), RelationCloseSmgr(), RelationSetNewRelfilenumber(), ScanSourceDatabasePgClass(), smgrcloseall(), smgrcloserellocator(), and smgrDoPendingDeletes().
void smgrcloseall | ( | void | ) |
Definition at line 322 of file smgr.c.
References hash_seq_init(), hash_seq_search(), smgrclose(), SMgrRelationHash, and status().
Referenced by BackgroundWriterMain(), CheckpointerMain(), RelationCacheInvalidate(), RequestCheckpoint(), WalWriterMain(), and XLogDropDatabase().
void smgrcloserellocator | ( | RelFileLocatorBackend | rlocator | ) |
Definition at line 346 of file smgr.c.
References HASH_FIND, hash_search(), smgrclose(), and SMgrRelationHash.
Referenced by CreateAndCopyRelationData(), and LocalExecuteInvalidationMessage().
void smgrcreate | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
bool | isRedo | ||
) |
Definition at line 369 of file smgr.c.
References f_smgr::smgr_create, SMgrRelationData::smgr_which, and smgrsw.
Referenced by CreateAndCopyRelationData(), fill_seq_with_data(), fsm_extend(), heapam_relation_copy_data(), heapam_relation_set_new_filelocator(), index_build(), index_copy_data(), RelationCreateStorage(), smgr_redo(), vm_extend(), and XLogReadBufferExtended().
void smgrdosyncall | ( | SMgrRelation * | rels, |
int | nrels | ||
) |
Definition at line 384 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 420 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 247 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(), FreeSpaceMapPrepareTruncateRel(), fsm_extend(), fsm_readbuf(), heapam_relation_copy_data(), index_build(), index_copy_data(), pg_prewarm(), RelationTruncate(), smgr_redo(), smgrDoPendingSyncs(), visibilitymap_prepare_truncate(), vm_extend(), vm_readbuf(), and XLogPrefetcherNextBlock().
void smgrextend | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
const void * | buffer, | ||
bool | skipFsync | ||
) |
Definition at line 493 of file smgr.c.
References InvalidBlockNumber, SMgrRelationData::smgr_cached_nblocks, f_smgr::smgr_extend, SMgrRelationData::smgr_which, and smgrsw.
Referenced by _bt_blwritepage(), _hash_alloc_buckets(), end_heap_rewrite(), fsm_extend(), gist_indexsortbuild(), gist_indexsortbuild_flush_ready_pages(), raw_heap_insert(), ReadBuffer_common(), RelationCopyStorage(), RelationCopyStorageUsingBuffer(), and vm_extend().
void smgrimmedsync | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 691 of file smgr.c.
References f_smgr::smgr_immedsync, SMgrRelationData::smgr_which, and smgrsw.
Referenced by _bt_load(), blbuildempty(), btbuildempty(), end_heap_rewrite(), gist_indexsortbuild(), heapam_relation_set_new_filelocator(), RelationCopyStorage(), and spgbuildempty().
void smgrinit | ( | void | ) |
Definition at line 111 of file smgr.c.
References i, NSmgr, on_proc_exit(), f_smgr::smgr_init, smgrshutdown(), and smgrsw.
Referenced by BaseInit().
BlockNumber smgrnblocks | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 579 of file smgr.c.
References InvalidBlockNumber, SMgrRelationData::smgr_cached_nblocks, f_smgr::smgr_nblocks, SMgrRelationData::smgr_which, smgrnblocks_cached(), and smgrsw.
Referenced by FreeSpaceMapPrepareTruncateRel(), fsm_extend(), fsm_readbuf(), gistBuildCallback(), ReadBuffer_common(), RelationCopyStorage(), RelationCopyStorageUsingBuffer(), RelationGetNumberOfBlocksInFork(), ScanSourceDatabasePgClass(), smgrDoPendingSyncs(), table_block_relation_size(), visibilitymap_prepare_truncate(), vm_extend(), vm_readbuf(), XLogPrefetcherNextBlock(), and XLogReadBufferExtended().
BlockNumber smgrnblocks_cached | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 603 of file smgr.c.
References InRecovery, InvalidBlockNumber, and SMgrRelationData::smgr_cached_nblocks.
Referenced by DropRelationBuffers(), DropRelationsAllBuffers(), and smgrnblocks().
SMgrRelation smgropen | ( | RelFileLocator | rlocator, |
BackendId | backend | ||
) |
Definition at line 146 of file smgr.c.
References RelFileLocatorBackend::backend, dlist_init(), dlist_push_tail(), HASHCTL::entrysize, HASH_BLOBS, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), i, InvalidBlockNumber, HASHCTL::keysize, RelFileLocatorBackend::locator, MAX_FORKNUM, SMgrRelationData::node, SMgrRelationData::smgr_cached_nblocks, f_smgr::smgr_open, SMgrRelationData::smgr_owner, SMgrRelationData::smgr_targblock, SMgrRelationData::smgr_which, SMgrRelationHash, smgrsw, and unowned_relns.
Referenced by CreateAndCopyRelationData(), DropRelationFiles(), fill_seq_with_data(), FlushBuffer(), heapam_relation_copy_data(), index_copy_data(), IssuePendingWritebacks(), LocalBufferAlloc(), mdsyncfiletag(), ReadBufferWithoutRelcache(), RelationCopyStorageUsingBuffer(), RelationCreateStorage(), RelationGetSmgr(), RelationSetNewRelfilenumber(), ScanSourceDatabasePgClass(), smgr_redo(), smgrDoPendingDeletes(), smgrDoPendingSyncs(), XLogPrefetcherNextBlock(), and XLogReadBufferExtended().
bool smgrprefetch | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum | ||
) |
Definition at line 518 of file smgr.c.
References f_smgr::smgr_prefetch, SMgrRelationData::smgr_which, and smgrsw.
Referenced by PrefetchLocalBuffer(), and PrefetchSharedBuffer().
void smgrread | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
void * | buffer | ||
) |
Definition at line 532 of file smgr.c.
References f_smgr::smgr_read, SMgrRelationData::smgr_which, and smgrsw.
Referenced by pg_prewarm(), ReadBuffer_common(), and RelationCopyStorage().
void smgrrelease | ( | SMgrRelation | reln | ) |
Definition at line 288 of file smgr.c.
References InvalidBlockNumber, MAX_FORKNUM, SMgrRelationData::smgr_cached_nblocks, f_smgr::smgr_close, SMgrRelationData::smgr_which, and smgrsw.
Referenced by smgrreleaseall().
void smgrreleaseall | ( | void | ) |
Definition at line 303 of file smgr.c.
References hash_seq_init(), hash_seq_search(), SMgrRelationHash, smgrrelease(), and status().
Referenced by ProcessBarrierSmgrRelease().
void smgrsetowner | ( | SMgrRelation * | owner, |
SMgrRelation | reln | ||
) |
Definition at line 198 of file smgr.c.
References Assert(), dlist_delete(), SMgrRelationData::node, and SMgrRelationData::smgr_owner.
Referenced by RelationGetSmgr().
|
static |
Definition at line 129 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 626 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 smgrwrite | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
const void * | buffer, | ||
bool | skipFsync | ||
) |
Definition at line 554 of file smgr.c.
References SMgrRelationData::smgr_which, f_smgr::smgr_write, and smgrsw.
Referenced by _bt_blwritepage(), blbuildempty(), btbuildempty(), FlushBuffer(), FlushRelationBuffers(), gist_indexsortbuild(), LocalBufferAlloc(), and spgbuildempty().
void smgrwriteback | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
BlockNumber | nblocks | ||
) |
Definition at line 567 of file smgr.c.
References SMgrRelationData::smgr_which, f_smgr::smgr_writeback, and smgrsw.
Referenced by IssuePendingWritebacks().
Definition at line 88 of file smgr.c.
Referenced by smgrinit(), and smgrshutdown().
|
static |
Definition at line 94 of file smgr.c.
Referenced by smgrclose(), smgrcloseall(), smgrcloserellocator(), smgropen(), and smgrreleaseall().
|
static |
Definition at line 67 of file smgr.c.
Referenced by smgrclose(), smgrcreate(), smgrdosyncall(), smgrdounlinkall(), smgrexists(), smgrextend(), smgrimmedsync(), smgrinit(), smgrnblocks(), smgropen(), smgrprefetch(), smgrread(), smgrrelease(), smgrshutdown(), smgrtruncate(), smgrwrite(), and smgrwriteback().
|
static |
Definition at line 96 of file smgr.c.
Referenced by AtEOXact_SMgr(), smgrclearowner(), and smgropen().