|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/xlogutils.h"#include "lib/ilist.h"#include "miscadmin.h"#include "storage/aio.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 |
| const PgAioTargetInfo | aio_smgr_target_info |
Definition at line 1017 of file smgr.c.
References smgrdestroyall().
Referenced by AbortTransaction(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), PrepareTransaction(), and WalWriterMain().
| void pgaio_io_set_target_smgr | ( | PgAioHandle * | ioh, |
| SMgrRelationData * | smgr, | ||
| ForkNumber | forknum, | ||
| BlockNumber | blocknum, | ||
| int | nblocks, | ||
| bool | skip_fsync | ||
| ) |
Definition at line 1038 of file smgr.c.
References fb(), RelFileLocatorBackend::locator, pgaio_io_get_target_data(), pgaio_io_set_target(), PGAIO_TID_SMGR, SMgrRelationData::smgr_rlocator, and SmgrIsTemp.
Referenced by mdstartreadv().
Definition at line 1027 of file smgr.c.
References smgrreleaseall().
Referenced by ProcessProcSignalBarrier().
|
static |
Definition at line 1104 of file smgr.c.
References _, fb(), INVALID_PROC_NUMBER, MyProcNumber, psprintf(), relpathbackend, and RelPathStr::str.
|
static |
Definition at line 1064 of file smgr.c.
References Assert, fb(), INTERRUPTS_CAN_BE_PROCESSED, INVALID_PROC_NUMBER, pg_unreachable, pgaio_io_get_op(), pgaio_io_get_op_data(), pgaio_io_get_owner(), pgaio_io_get_target_data(), PGAIO_OP_INVALID, PGAIO_OP_READV, PGAIO_OP_WRITEV, smgrfd(), and smgropen().
| void smgrclose | ( | SMgrRelation | reln | ) |
Definition at line 374 of file smgr.c.
References fb(), and 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 481 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, f_smgr::smgr_create, 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 323 of file smgr.c.
References Assert, dlist_delete(), elog, ERROR, fb(), HASH_REMOVE, hash_search(), HOLD_INTERRUPTS, MAX_FORKNUM, RESUME_INTERRUPTS, f_smgr::smgr_close, SMgrRelationHash, and smgrsw.
Referenced by smgrdestroyall().
Definition at line 386 of file smgr.c.
References dlist_mutable_iter::cur, dlist_container, dlist_foreach_modify, HOLD_INTERRUPTS, RESUME_INTERRUPTS, smgrdestroy(), and unpinned_relns.
Referenced by AtEOXact_SMgr(), BackgroundWriterMain(), CheckpointerMain(), RequestCheckpoint(), xlog_redo(), and XLogDropDatabase().
| void smgrdosyncall | ( | SMgrRelation * | rels, |
| int | nrels | ||
| ) |
Definition at line 498 of file smgr.c.
References fb(), FlushRelationsAllBuffers(), HOLD_INTERRUPTS, i, MAX_FORKNUM, RESUME_INTERRUPTS, f_smgr::smgr_immedsync, SMgrRelationData::smgr_which, and smgrsw.
Referenced by smgrDoPendingSyncs().
| void smgrdounlinkall | ( | SMgrRelation * | rels, |
| int | nrels, | ||
| bool | isRedo | ||
| ) |
Definition at line 538 of file smgr.c.
References CacheInvalidateSmgr(), DropRelationsAllBuffers(), fb(), HOLD_INTERRUPTS, i, MAX_FORKNUM, palloc_array, pfree(), RESUME_INTERRUPTS, SMgrRelationData::smgr_rlocator, SMgrRelationData::smgr_which, and smgrsw.
Referenced by DropRelationFiles(), RelationSetNewRelfilenumber(), and smgrDoPendingDeletes().
| bool smgrexists | ( | SMgrRelation | reln, |
| ForkNumber | forknum | ||
| ) |
Definition at line 462 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, f_smgr::smgr_exists, and smgrsw.
Referenced by autoprewarm_database_main(), bt_index_check_callback(), 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 620 of file smgr.c.
References fb(), HOLD_INTERRUPTS, InvalidBlockNumber, RESUME_INTERRUPTS, f_smgr::smgr_extend, and smgrsw.
Referenced by _hash_alloc_buckets(), RelationCopyStorageUsingBuffer(), and smgr_bulk_flush().
|
static |
Definition at line 989 of file smgr.c.
References Assert, fb(), fd(), INTERRUPTS_CAN_BE_PROCESSED, f_smgr::smgr_fd, and smgrsw.
Referenced by smgr_aio_reopen().
| void smgrimmedsync | ( | SMgrRelation | reln, |
| ForkNumber | forknum | ||
| ) |
Definition at line 974 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, f_smgr::smgr_immedsync, and smgrsw.
Referenced by smgr_bulk_finish().
Definition at line 188 of file smgr.c.
References HOLD_INTERRUPTS, i, NSmgr, on_proc_exit(), RESUME_INTERRUPTS, f_smgr::smgr_init, smgrshutdown(), and smgrsw.
Referenced by BaseInit().
| uint32 smgrmaxcombine | ( | SMgrRelation | reln, |
| ForkNumber | forknum, | ||
| BlockNumber | blocknum | ||
| ) |
Definition at line 697 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, f_smgr::smgr_maxcombine, and smgrsw.
Referenced by StartReadBuffersImpl().
| BlockNumber smgrnblocks | ( | SMgrRelation | reln, |
| ForkNumber | forknum | ||
| ) |
Definition at line 819 of file smgr.c.
References fb(), HOLD_INTERRUPTS, InvalidBlockNumber, RESUME_INTERRUPTS, f_smgr::smgr_nblocks, smgrnblocks_cached(), and smgrsw.
Referenced by ExtendBufferedRelLocal(), ExtendBufferedRelShared(), ExtendBufferedRelTo(), FreeSpaceMapPrepareTruncateRel(), fsm_readbuf(), gistBuildCallback(), pg_truncate_visibility_map(), RelationCopyStorage(), RelationCopyStorageUsingBuffer(), RelationGetNumberOfBlocksInFork(), RelationTruncate(), ScanSourceDatabasePgClass(), smgr_bulk_start_smgr(), smgr_redo(), smgrDoPendingSyncs(), table_block_relation_size(), visibilitymap_prepare_truncate(), vm_readbuf(), XLogPrefetcherNextBlock(), and XLogReadBufferExtended().
| BlockNumber smgrnblocks_cached | ( | SMgrRelation | reln, |
| ForkNumber | forknum | ||
| ) |
Definition at line 847 of file smgr.c.
References fb(), InRecovery, and InvalidBlockNumber.
Referenced by DropRelationBuffers(), DropRelationsAllBuffers(), and smgrnblocks().
| SMgrRelation smgropen | ( | RelFileLocator | rlocator, |
| ProcNumber | backend | ||
| ) |
Definition at line 240 of file smgr.c.
References Assert, ctl, dlist_init(), dlist_push_tail(), fb(), HASH_BLOBS, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), HOLD_INTERRUPTS, i, InvalidBlockNumber, HASHCTL::keysize, MAX_FORKNUM, RelFileNumberIsValid, RelFileLocator::relNumber, RESUME_INTERRUPTS, f_smgr::smgr_open, SMgrRelationHash, smgrsw, and unpinned_relns.
Referenced by CreateAndCopyRelationData(), CreateFakeRelcacheEntry(), DropRelationFiles(), fill_seq_with_data(), FlushBuffer(), FlushLocalBuffer(), IssuePendingWritebacks(), mdsyncfiletag(), ReadBufferWithoutRelcache(), RelationCopyStorageUsingBuffer(), RelationCreateStorage(), RelationGetSmgr(), RelationSetNewRelfilenumber(), ScanSourceDatabasePgClass(), smgr_aio_reopen(), smgr_redo(), smgrDoPendingDeletes(), smgrDoPendingSyncs(), XLogPrefetcherNextBlock(), and XLogReadBufferExtended().
| void smgrpin | ( | SMgrRelation | reln | ) |
Definition at line 296 of file smgr.c.
References dlist_delete(), and fb().
Referenced by RelationGetSmgr().
| bool smgrprefetch | ( | SMgrRelation | reln, |
| ForkNumber | forknum, | ||
| BlockNumber | blocknum, | ||
| int | nblocks | ||
| ) |
Definition at line 678 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, f_smgr::smgr_prefetch, and smgrsw.
Referenced by PrefetchLocalBuffer(), PrefetchSharedBuffer(), and StartReadBuffersImpl().
| void smgrreadv | ( | SMgrRelation | reln, |
| ForkNumber | forknum, | ||
| BlockNumber | blocknum, | ||
| void ** | buffers, | ||
| BlockNumber | nblocks | ||
| ) |
Definition at line 721 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, f_smgr::smgr_readv, and smgrsw.
Referenced by smgrread().
| void smgrregistersync | ( | SMgrRelation | reln, |
| ForkNumber | forknum | ||
| ) |
Definition at line 940 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, f_smgr::smgr_registersync, and smgrsw.
Referenced by smgr_bulk_finish().
| void smgrrelease | ( | SMgrRelation | reln | ) |
Definition at line 350 of file smgr.c.
References fb(), HOLD_INTERRUPTS, InvalidBlockNumber, MAX_FORKNUM, RESUME_INTERRUPTS, f_smgr::smgr_close, and smgrsw.
Referenced by smgrclose(), smgrreleaseall(), and smgrreleaserellocator().
Definition at line 412 of file smgr.c.
References fb(), hash_seq_init(), hash_seq_search(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, SMgrRelationHash, and smgrrelease().
Referenced by ProcessBarrierSmgrRelease(), read_rel_block_ll(), and RelationCacheInvalidate().
| void smgrreleaserellocator | ( | RelFileLocatorBackend | rlocator | ) |
Definition at line 443 of file smgr.c.
References fb(), HASH_FIND, hash_search(), SMgrRelationHash, and smgrrelease().
Referenced by LocalExecuteInvalidationMessage().
Definition at line 210 of file smgr.c.
References HOLD_INTERRUPTS, i, NSmgr, RESUME_INTERRUPTS, f_smgr::smgr_shutdown, and smgrsw.
Referenced by smgrinit().
| void smgrstartreadv | ( | PgAioHandle * | ioh, |
| SMgrRelation | reln, | ||
| ForkNumber | forknum, | ||
| BlockNumber | blocknum, | ||
| void ** | buffers, | ||
| BlockNumber | nblocks | ||
| ) |
Definition at line 753 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, f_smgr::smgr_startreadv, and smgrsw.
Referenced by AsyncReadBuffers(), and read_rel_block_ll().
| void smgrtruncate | ( | SMgrRelation | reln, |
| ForkNumber * | forknum, | ||
| int | nforks, | ||
| BlockNumber * | old_nblocks, | ||
| BlockNumber * | nblocks | ||
| ) |
Definition at line 875 of file smgr.c.
References CacheInvalidateSmgr(), DropRelationBuffers(), fb(), i, InvalidBlockNumber, f_smgr::smgr_truncate, and smgrsw.
Referenced by pg_truncate_visibility_map(), RelationTruncate(), and smgr_redo().
| void smgrunpin | ( | SMgrRelation | reln | ) |
Definition at line 311 of file smgr.c.
References Assert, dlist_push_tail(), fb(), and unpinned_relns.
Referenced by RelationCloseSmgr().
| void smgrwriteback | ( | SMgrRelation | reln, |
| ForkNumber | forknum, | ||
| BlockNumber | blocknum, | ||
| BlockNumber | nblocks | ||
| ) |
Definition at line 805 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, 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 791 of file smgr.c.
References fb(), HOLD_INTERRUPTS, RESUME_INTERRUPTS, f_smgr::smgr_writev, and smgrsw.
Referenced by smgrwrite().
| void smgrzeroextend | ( | SMgrRelation | reln, |
| ForkNumber | forknum, | ||
| BlockNumber | blocknum, | ||
| int | nblocks, | ||
| bool | skipFsync | ||
| ) |
Definition at line 649 of file smgr.c.
References fb(), HOLD_INTERRUPTS, InvalidBlockNumber, RESUME_INTERRUPTS, f_smgr::smgr_zeroextend, and smgrsw.
Referenced by ExtendBufferedRelLocal(), and ExtendBufferedRelShared().
| const PgAioTargetInfo aio_smgr_target_info |
Definition at line 172 of file smgr.c.
Definition at line 154 of file smgr.c.
Referenced by smgrinit(), and smgrshutdown().
Definition at line 160 of file smgr.c.
Referenced by smgrdestroy(), smgropen(), smgrreleaseall(), and smgrreleaserellocator().
Definition at line 128 of file smgr.c.
Referenced by smgrcreate(), smgrdestroy(), smgrdosyncall(), smgrdounlinkall(), smgrexists(), smgrextend(), smgrfd(), smgrimmedsync(), smgrinit(), smgrmaxcombine(), smgrnblocks(), smgropen(), smgrprefetch(), smgrreadv(), smgrregistersync(), smgrrelease(), smgrshutdown(), smgrstartreadv(), smgrtruncate(), smgrwriteback(), smgrwritev(), and smgrzeroextend().
|
static |
Definition at line 162 of file smgr.c.
Referenced by smgrdestroyall(), smgropen(), and smgrunpin().