|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <dirent.h>#include <sys/file.h>#include <sys/param.h>#include <sys/resource.h>#include <sys/stat.h>#include <sys/types.h>#include <sys/mman.h>#include <limits.h>#include <unistd.h>#include <fcntl.h>#include "access/xact.h"#include "access/xlog.h"#include "catalog/pg_tablespace.h"#include "common/file_perm.h"#include "common/file_utils.h"#include "common/pg_prng.h"#include "miscadmin.h"#include "pgstat.h"#include "postmaster/startup.h"#include "storage/aio.h"#include "storage/fd.h"#include "storage/ipc.h"#include "utils/guc.h"#include "utils/guc_hooks.h"#include "utils/resowner.h"#include "utils/varlena.h"
Go to the source code of this file.
Data Structures | |
| struct | vfd |
| struct | AllocateDesc |
Macros | |
| #define | NUM_RESERVED_FDS 10 |
| #define | FD_MINFREE 48 |
| #define | DO_DB(A) ((void) 0) |
| #define | VFD_CLOSED (-1) |
| #define | FileIsValid(file) ((file) > 0 && (file) < (int) SizeVfdCache && VfdCache[file].fileName != NULL) |
| #define | FileIsNotOpen(file) (VfdCache[file].fd == VFD_CLOSED) |
| #define | FD_DELETE_AT_CLOSE (1 << 0) /* T = delete when closed */ |
| #define | FD_CLOSE_AT_EOXACT (1 << 1) /* T = close at eoXact */ |
| #define | FD_TEMP_FILE_LIMIT (1 << 2) /* T = respect temp_file_limit */ |
Typedefs | |
| typedef struct vfd | Vfd |
Enumerations | |
| enum | AllocateDescKind { AllocateDescFile , AllocateDescPipe , AllocateDescDir , AllocateDescRawFD } |
Definition at line 183 of file fd.c.
| #define FD_TEMP_FILE_LIMIT (1 << 2) /* T = respect temp_file_limit */ |
| #define FileIsNotOpen | ( | file | ) | (VfdCache[file].fd == VFD_CLOSED) |
| #define FileIsValid | ( | file | ) | ((file) > 0 && (file) < (int) SizeVfdCache && VfdCache[file].fileName != NULL) |
| Enumerator | |
|---|---|
| AllocateDescFile | |
| AllocateDescPipe | |
| AllocateDescDir | |
| AllocateDescRawFD | |
Definition at line 250 of file fd.c.
Definition at line 1171 of file fd.c.
References fb(), max_safe_fds, numExternalFDs, and ReserveExternalFD().
Referenced by CreateWaitEventSet(), and libpqsrv_connect_prepare().
Definition at line 2890 of file fd.c.
References allocatedDescs, AllocateDescDir, AllocateDesc::create_subid, AllocateDesc::desc, AllocateDesc::dir, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, fb(), GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, numAllocatedDescs, opendir(), ReleaseLruFile(), ReleaseLruFiles(), and reserveAllocatedDesc().
Referenced by calculate_database_size(), calculate_tablespace_size(), CheckPointLogicalRewriteHeap(), CheckPointSnapBuild(), CheckTablespaceDirectory(), CleanupBackupHistory(), copydir(), db_dir_size(), DeleteAllExportedSnapshotFiles(), destroy_tablespace_directories(), directory_is_empty(), do_pg_backup_start(), dsm_cleanup_for_mmap(), extension_file_exists(), get_ext_ver_list(), GetConfFilesInDir(), getInstallationPaths(), GetWalSummaries(), movedb(), ParseTzFile(), perform_base_backup(), pg_available_extension_versions(), pg_available_extensions(), pg_ls_dir(), pg_ls_dir_files(), pg_tablespace_databases(), pg_tzenumerate_next(), pg_tzenumerate_start(), pgarch_readyXlog(), RelationCacheInitFileRemove(), RelationCacheInitFileRemoveInDir(), RemoveNonParentXlogFiles(), RemoveOldXlogFiles(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePgTempRelationFiles(), RemovePgTempRelationFilesInDbspace(), RemoveTempXlogFiles(), ReorderBufferCleanupSerializedTXNs(), ResetUnloggedRelations(), ResetUnloggedRelationsInDbspaceDir(), ResetUnloggedRelationsInTablespaceDir(), restoreTwoPhaseData(), scan_directory_ci(), sendDir(), SlruScanDirectory(), StartupReorderBuffer(), StartupReplicationSlots(), SyncDataDirectory(), UpdateLogicalMappings(), walkdir(), and XLogGetOldestSegno().
Definition at line 2627 of file fd.c.
References allocatedDescs, AllocateDescFile, AllocateDesc::create_subid, AllocateDesc::desc, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, fb(), AllocateDesc::file, GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, mode, name, numAllocatedDescs, ReleaseLruFile(), ReleaseLruFiles(), and reserveAllocatedDesc().
Referenced by AlterSystemSetConfigFile(), apw_dump_now(), apw_load_buffers(), BeginCopyFrom(), BeginCopyTo(), checkControlFile(), do_pg_backup_stop(), entry_reset(), existsTimeLineHistory(), ExportSnapshot(), gc_qtexts(), GetHugePageSize(), ImportSnapshot(), load_dh_file(), load_relcache_init_file(), open_auth_file(), parse_extension_control_file(), ParseConfigFile(), ParseTzFile(), pg_current_logfile(), pg_promote(), pgss_shmem_shutdown(), pgss_shmem_startup(), pgstat_read_statsfile(), pgstat_write_statsfile(), read_backup_label(), read_binary_file(), read_tablespace_map(), read_whole_file(), readTimeLineHistory(), test_custom_stats_var_from_serialized_data(), test_custom_stats_var_to_serialized_data(), tsearch_readline_begin(), ValidatePgVersion(), write_relcache_init_file(), XLogArchiveForceDone(), and XLogArchiveNotify().
Definition at line 1401 of file fd.c.
References Assert, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, fb(), vfd::fd, i, LOG, MemSet, vfd::nextFree, realloc, SizeVfdCache, VFD_CLOSED, and VfdCache.
Referenced by PathNameOpenFilePerm().
Definition at line 4078 of file fd.c.
References io_direct_flags.
| void AtEOSubXact_Files | ( | bool | isCommit, |
| SubTransactionId | mySubid, | ||
| SubTransactionId | parentSubid | ||
| ) |
Definition at line 3180 of file fd.c.
References allocatedDescs, AllocateDesc::create_subid, fb(), FreeDesc(), i, and numAllocatedDescs.
Referenced by AbortSubTransaction(), and CommitSubTransaction().
Definition at line 3213 of file fd.c.
References CleanupTempFiles(), fb(), numTempTableSpaces, and tempTableSpaces.
Referenced by AbortTransaction(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), pgarch_archiveXlog(), PrepareTransaction(), WalSummarizerMain(), and WalWriterMain().
Definition at line 1089 of file fd.c.
References BasicOpenFilePerm(), and pg_file_create_mode.
Referenced by AlterSystemSetConfigFile(), ReadControlFile(), update_controlfile(), wal_segment_open(), WalSndSegmentOpen(), WriteControlFile(), XLogFileInit(), XLogFileInitInternal(), XLogFileOpen(), and XLogFileRead().
Definition at line 1111 of file fd.c.
References close, ereport, errcode(), errmsg(), fb(), fd(), LOG, PG_O_DIRECT, and ReleaseLruFile().
Referenced by BasicOpenFile(), LruInsert(), OpenTransientFilePerm(), PathNameOpenFilePerm(), and readRecoverySignalFile().
Definition at line 3227 of file fd.c.
References CleanupTempFiles(), and fb().
Referenced by InitTemporaryFileAccess().
Definition at line 3991 of file fd.c.
References fb(), GUC_check_errdetail, guc_malloc(), IO_DIRECT_DATA, IO_DIRECT_WAL, IO_DIRECT_WAL_INIT, lfirst, list_free(), LOG, newval, pfree(), pg_strcasecmp(), pstrdup(), and SplitGUCList().
Definition at line 3250 of file fd.c.
References allocatedDescs, Assert, elog, fb(), FD_CLOSE_AT_EOXACT, FD_DELETE_AT_CLOSE, vfd::fdstate, FileClose(), FileIsNotOpen, FreeDesc(), have_xact_temporary_files, i, numAllocatedDescs, SizeVfdCache, VfdCache, and WARNING.
Referenced by AtEOXact_Files(), and BeforeShmemExit_Files().
Definition at line 3067 of file fd.c.
References Assert, FileIsNotOpen, i, LruDelete(), and SizeVfdCache.
Referenced by standard_ProcessUtility().
Definition at line 3038 of file fd.c.
References allocatedDescs, AllocateDescPipe, AllocateDesc::desc, DO_DB, elog, fb(), AllocateDesc::file, FreeDesc(), i, AllocateDesc::kind, LOG, numAllocatedDescs, and WARNING.
Referenced by ClosePipeFromProgram(), ClosePipeToProgram(), pg_import_system_collations(), run_ssl_passphrase_command(), and shell_finish_command().
Definition at line 2854 of file fd.c.
References allocatedDescs, AllocateDescRawFD, close, AllocateDesc::desc, DO_DB, elog, AllocateDesc::fd, fd(), FreeDesc(), i, AllocateDesc::kind, LOG, numAllocatedDescs, pgaio_closing_fd(), and WARNING.
Referenced by ApplyLogicalMappingFile(), be_lo_export(), CheckPointLogicalRewriteHeap(), CheckPointReplicationOrigin(), clone_file(), compare_files(), copy_file(), CreateDirAndVersionFile(), dsm_impl_mmap(), durable_rename(), fsync_fname_ext(), get_controlfile_by_exact_path(), heap_xlog_logical_rewrite(), lo_import_internal(), perform_base_backup(), pg_truncate(), qtext_load_file(), qtext_store(), read_relmap_file(), ReadTwoPhaseFile(), RecreateTwoPhaseFile(), ReorderBufferSerializeChange(), ReorderBufferSerializeTXN(), RestoreSlotFromDisk(), SaveSlotToPath(), sendFile(), SendTimeLineHistory(), SimpleLruDoesPhysicalPageExist(), SimpleLruWriteAll(), SlruInternalWritePage(), SlruPhysicalReadPage(), SlruPhysicalWritePage(), SlruSyncFileTag(), SnapBuildRestoreContents(), SnapBuildRestoreSnapshot(), SnapBuildSerialize(), StartupReplicationOrigin(), write_relmap_file(), writeTimeLineHistory(), writeTimeLineHistoryFile(), and XLogFileCopy().
Definition at line 964 of file fd.c.
References close, elog, ereport, errmsg(), fb(), fd(), j, palloc(), pfree(), repalloc(), and WARNING.
Referenced by set_max_safe_fds().
Definition at line 3985 of file fd.c.
References data_sync_retry, and PANIC.
Referenced by CheckPointLogicalRewriteHeap(), CreateDirAndVersionFile(), FileClose(), fsync_fname(), heap_xlog_logical_rewrite(), logical_end_heap_rewrite(), LruDelete(), mdimmedsync(), pg_flush_data(), ProcessSyncRequests(), register_dirty_segment(), SlruReportIOError(), writeTimeLineHistory(), writeTimeLineHistoryFile(), and XLogFileCopy().
Definition at line 3808 of file fd.c.
References ereport_startup_progress, fb(), and fsync_fname_ext().
Referenced by SyncDataDirectory().
Definition at line 1253 of file fd.c.
References Assert, DO_DB, elog, fb(), LOG, vfd::lruLessRecently, vfd::lruMoreRecently, and VfdCache.
Referenced by FileAccess(), FileClose(), and LruDelete().
Definition at line 782 of file fd.c.
References CloseTransientFile(), ereport, errcode_for_file_access(), errmsg(), fb(), fd(), fsync_fname_ext(), fsync_parent_path(), OpenTransientFile(), PG_BINARY, and pg_fsync().
Referenced by AlterSystemSetConfigFile(), apw_dump_now(), BaseBackup(), basic_archive_file(), bbsink_server_end_manifest(), CheckPointReplicationOrigin(), cleanup_objects_atexit(), CleanupAfterArchiveRecovery(), dir_close(), InitWalRecovery(), InstallXLogFileSegment(), KeepFileRestoredFromArchive(), pgss_shmem_shutdown(), pgstat_write_statsfile(), StartupXLOG(), SummarizeWAL(), write_relmap_file(), writeTimeLineHistory(), writeTimeLineHistoryFile(), and XLogArchiveForceDone().
Definition at line 872 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), fb(), and fsync_parent_path().
Referenced by InstallXLogFileSegment(), RemoveXlogFile(), and StartupXLOG().
Definition at line 1479 of file fd.c.
References Delete(), DO_DB, elog, fb(), FileIsNotOpen, Insert(), LOG, LruInsert(), and VfdCache.
Referenced by FileFallocate(), FileGetRawDesc(), FilePrefetch(), FileReadV(), FileSize(), FileStartReadV(), FileSync(), FileTruncate(), FileWriteback(), FileWriteV(), and FileZero().
Definition at line 1965 of file fd.c.
References Assert, close, data_sync_elevel(), Delete(), DO_DB, elog, ereport, errcode_for_file_access(), errmsg(), fb(), FD_DELETE_AT_CLOSE, FD_TEMP_FILE_LIMIT, FileIsNotOpen, FileIsValid, FreeVfd(), LOG, nfile, pgaio_closing_fd(), ReportTemporaryFileUsage(), ResourceOwnerForgetFile(), stat, temporary_files_size, VFD_CLOSED, and VfdCache.
Referenced by bbsink_server_end_archive(), bbsink_server_end_manifest(), BufFileClose(), BufFileTruncateFileSet(), CleanupTempFiles(), logical_end_heap_rewrite(), mdclose(), mdimmedsync(), mdregistersync(), mdsyncfiletag(), mdtruncate(), pg_wal_summary_contents(), PrepareForIncrementalBackup(), ReorderBufferIterTXNFinish(), ReorderBufferRestoreChanges(), ResOwnerReleaseFile(), and SummarizeWAL().
Definition at line 2407 of file fd.c.
References Assert, DO_DB, EINTR, elog, EOPNOTSUPP, fb(), fd(), FileAccess(), FileIsValid, FileZero(), INT64_FORMAT, LOG, pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by mdzeroextend().
Definition at line 2515 of file fd.c.
References Assert, fb(), vfd::fd, FileAccess(), FileIsValid, and VfdCache.
Referenced by mdfd().
Definition at line 2531 of file fd.c.
References Assert, vfd::fileFlags, FileIsValid, and VfdCache.
Definition at line 2541 of file fd.c.
References Assert, FileIsValid, vfd::fileMode, and VfdCache.
Definition at line 2499 of file fd.c.
References Assert, FileIsValid, vfd::fileName, and VfdCache.
Referenced by _mdnblocks(), bbsink_server_archive_contents(), bbsink_server_end_archive(), bbsink_server_manifest_contents(), BufFileDumpBuffer(), BufFileLoadBuffer(), BufFileSeek(), BufFileSize(), BufFileTruncateFileSet(), mdextend(), mdimmedsync(), mdreadv(), mdstartreadv(), mdsyncfiletag(), mdtruncate(), mdwritev(), mdzeroextend(), pg_wal_summary_contents(), PrepareForIncrementalBackup(), ReadWalSummary(), register_dirty_segment(), and WriteWalSummary().
Definition at line 2066 of file fd.c.
References Assert, DO_DB, EINTR, elog, fb(), fd(), FileAccess(), FileIsValid, INT64_FORMAT, LOG, pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by mdprefetch().
| ssize_t FileReadV | ( | File | file, |
| const struct iovec * | iov, | ||
| int | iovcnt, | ||
| pgoff_t | offset, | ||
| uint32 | wait_event_info | ||
| ) |
Definition at line 2148 of file fd.c.
References _dosmaperr(), Assert, DO_DB, EINTR, elog, error(), fb(), FileAccess(), FileIsValid, INT64_FORMAT, LOG, pg_preadv(), pg_usleep(), pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by FileRead(), and mdreadv().
Definition at line 2447 of file fd.c.
References Assert, DO_DB, elog, fb(), fd(), FileAccess(), FileIsNotOpen, FileIsValid, LOG, and VfdCache.
Referenced by _mdnblocks(), BufFileSeek(), and BufFileSize().
| int FileStartReadV | ( | PgAioHandle * | ioh, |
| File | file, | ||
| int | iovcnt, | ||
| pgoff_t | offset, | ||
| uint32 | wait_event_info | ||
| ) |
Definition at line 2204 of file fd.c.
References Assert, DO_DB, elog, fb(), FileAccess(), FileIsValid, INT64_FORMAT, LOG, pgaio_io_start_readv(), and VfdCache.
Referenced by mdstartreadv().
Definition at line 2335 of file fd.c.
References Assert, DO_DB, elog, fb(), fd(), FileAccess(), FileIsValid, LOG, pg_fsync(), pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by bbsink_server_end_archive(), logical_end_heap_rewrite(), mdimmedsync(), mdsyncfiletag(), and register_dirty_segment().
Definition at line 2464 of file fd.c.
References Assert, DO_DB, elog, fb(), fd(), FD_TEMP_FILE_LIMIT, FileAccess(), FileIsValid, vfd::fileSize, LOG, pg_ftruncate(), pgstat_report_wait_end(), pgstat_report_wait_start(), temporary_files_size, and VfdCache.
Referenced by BufFileTruncateFileSet(), and mdtruncate().
Definition at line 2122 of file fd.c.
References Assert, DO_DB, elog, fb(), fd(), FileAccess(), FileIsValid, INT64_FORMAT, LOG, pg_flush_data(), PG_O_DIRECT, pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by mdwriteback().
| ssize_t FileWriteV | ( | File | file, |
| const struct iovec * | iov, | ||
| int | iovcnt, | ||
| pgoff_t | offset, | ||
| uint32 | wait_event_info | ||
| ) |
Definition at line 2230 of file fd.c.
References _dosmaperr(), Assert, DO_DB, EINTR, elog, ereport, errcode(), errmsg(), ERROR, error(), fb(), FD_TEMP_FILE_LIMIT, FileAccess(), FileIsValid, vfd::fileSize, i, INT64_FORMAT, LOG, pg_pwritev(), pg_usleep(), pgstat_report_wait_end(), pgstat_report_wait_start(), temp_file_limit, temporary_files_size, and VfdCache.
Referenced by FileWrite(), and mdwritev().
Definition at line 2362 of file fd.c.
References Assert, DO_DB, elog, fb(), fd(), FileAccess(), FileIsValid, INT64_FORMAT, LOG, pg_pwrite_zeros(), pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by FileFallocate(), and mdzeroextend().
|
static |
Definition at line 2786 of file fd.c.
References allocatedDescs, AllocateDescDir, AllocateDescFile, AllocateDescPipe, AllocateDescRawFD, close, closedir(), AllocateDesc::desc, AllocateDesc::dir, elog, ERROR, fb(), AllocateDesc::fd, AllocateDesc::file, AllocateDesc::kind, numAllocatedDescs, and pgaio_closing_fd().
Referenced by AtEOSubXact_Files(), CleanupTempFiles(), ClosePipeStream(), CloseTransientFile(), FreeDir(), and FreeFile().
Definition at line 3008 of file fd.c.
References allocatedDescs, AllocateDescDir, closedir(), AllocateDesc::desc, AllocateDesc::dir, DO_DB, elog, fb(), FreeDesc(), i, AllocateDesc::kind, LOG, numAllocatedDescs, and WARNING.
Referenced by calculate_database_size(), calculate_tablespace_size(), CheckPointLogicalRewriteHeap(), CheckPointSnapBuild(), CleanupBackupHistory(), copydir(), db_dir_size(), DeleteAllExportedSnapshotFiles(), destroy_tablespace_directories(), directory_is_empty(), do_pg_backup_start(), dsm_cleanup_for_mmap(), extension_file_exists(), get_ext_ver_list(), GetConfFilesInDir(), getInstallationPaths(), GetWalSummaries(), movedb(), ParseTzFile(), perform_base_backup(), pg_available_extension_versions(), pg_available_extensions(), pg_ls_dir(), pg_ls_dir_files(), pg_tablespace_databases(), pg_tzenumerate_end(), pg_tzenumerate_next(), pgarch_readyXlog(), RelationCacheInitFileRemove(), RelationCacheInitFileRemoveInDir(), RemoveNonParentXlogFiles(), RemoveOldXlogFiles(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePgTempRelationFiles(), RemovePgTempRelationFilesInDbspace(), RemoveTempXlogFiles(), ReorderBufferCleanupSerializedTXNs(), ResetUnloggedRelations(), ResetUnloggedRelationsInDbspaceDir(), ResetUnloggedRelationsInTablespaceDir(), restoreTwoPhaseData(), scan_directory_ci(), sendDir(), SlruScanDirectory(), StartupReorderBuffer(), StartupReplicationSlots(), SyncDataDirectory(), UpdateLogicalMappings(), walkdir(), and XLogGetOldestSegno().
Definition at line 2826 of file fd.c.
References allocatedDescs, AllocateDescFile, AllocateDesc::desc, DO_DB, elog, fb(), AllocateDesc::file, FreeDesc(), i, AllocateDesc::kind, LOG, numAllocatedDescs, and WARNING.
Referenced by AlterSystemSetConfigFile(), apw_dump_now(), apw_load_buffers(), checkControlFile(), do_pg_backup_stop(), EndCopy(), EndCopyFrom(), entry_reset(), existsTimeLineHistory(), ExportSnapshot(), free_auth_file(), gc_qtexts(), GetHugePageSize(), ImportSnapshot(), load_dh_file(), load_relcache_init_file(), parse_extension_control_file(), ParseConfigFile(), ParseTzFile(), pg_current_logfile(), pg_promote(), pgss_shmem_shutdown(), pgss_shmem_startup(), pgstat_read_statsfile(), pgstat_write_statsfile(), read_backup_label(), read_binary_file(), read_tablespace_map(), read_whole_file(), readTimeLineHistory(), test_custom_stats_var_finish(), tsearch_readline_end(), ValidatePgVersion(), write_relcache_init_file(), XLogArchiveForceDone(), and XLogArchiveNotify().
Definition at line 1459 of file fd.c.
References DO_DB, elog, fb(), free, LOG, vfd::nextFree, and VfdCache.
Referenced by FileClose(), and PathNameOpenFilePerm().
Definition at line 756 of file fd.c.
References data_sync_elevel(), ERROR, fb(), and fsync_fname_ext().
Referenced by _CloseArchive(), _CloseArchive(), basic_archive_file(), CheckPointLogicalRewriteHeap(), CheckPointTwoPhase(), copydir(), CreateDirAndVersionFile(), CreateSlotOnDisk(), dir_close(), dir_finish(), dir_open_for_write(), main(), ReplicationSlotDropPtr(), ResetUnloggedRelationsInDbspaceDir(), RestoreSlotFromDisk(), SaveSlotToPath(), SimpleLruWriteAll(), SnapBuildRestoreSnapshot(), SnapBuildSerialize(), StartupReplicationSlots(), swap_catalog_files(), sync_queue_sync_all(), and tar_finish().
Definition at line 3846 of file fd.c.
References CloseTransientFile(), ereport, errcode_for_file_access(), errmsg(), fb(), fd(), OpenTransientFile(), PG_BINARY, and pg_fsync().
Referenced by datadir_fsync_fname(), durable_rename(), fsync_fname(), and fsync_parent_path().
Definition at line 3922 of file fd.c.
References fb(), fsync_fname_ext(), get_parent_directory(), MAXPGPATH, and strlcpy().
Referenced by dir_close(), dir_open_for_write(), durable_rename(), durable_unlink(), swap_catalog_files(), and tar_finish().
Definition at line 3158 of file fd.c.
References InvalidOid, nextTempTableSpace, numTempTableSpaces, and tempTableSpaces.
Referenced by GetDefaultTablespace(), and OpenTemporaryFile().
Definition at line 3140 of file fd.c.
References Assert, fb(), i, numTempTableSpaces, tempTableSpaces, and TempTablespacesAreSet().
Referenced by FileSetInit().
Definition at line 903 of file fd.c.
References Assert, ereport, errcode(), errmsg(), FATAL, fb(), vfd::fd, malloc, MemSet, SizeVfdCache, VFD_CLOSED, and VfdCache.
Referenced by BaseInit().
Definition at line 933 of file fd.c.
References Assert, before_shmem_exit(), BeforeShmemExit_Files(), fb(), and SizeVfdCache.
Referenced by BaseInit().
Definition at line 1300 of file fd.c.
References Assert, DO_DB, elog, fb(), LOG, vfd::lruLessRecently, vfd::lruMoreRecently, and VfdCache.
Referenced by AdvanceXLInsertBuffer(), CreateCheckPoint(), FileAccess(), GetXLogInsertRecPtr(), LruInsert(), PathNameOpenFilePerm(), ReserveXLogInsertLocation(), ReserveXLogSwitch(), StartupXLOG(), UpdateFullPageWrites(), WaitXLogInsertionsToFinish(), XLogInsertRecord(), and XLogWrite().
Definition at line 3498 of file fd.c.
References fb(), forkname_chars(), and name.
Referenced by RemovePgTempRelationFilesInDbspace(), and sendDir().
Definition at line 1272 of file fd.c.
References Assert, close, data_sync_elevel(), Delete(), DO_DB, elog, fb(), FD_TEMP_FILE_LIMIT, LOG, nfile, pgaio_closing_fd(), VFD_CLOSED, and VfdCache.
Referenced by closeAllVfds(), and ReleaseLruFile().
Definition at line 1322 of file fd.c.
References Assert, BasicOpenFilePerm(), DO_DB, elog, fb(), FileIsNotOpen, Insert(), LOG, nfile, ReleaseLruFiles(), and VfdCache.
Referenced by FileAccess().
Definition at line 3962 of file fd.c.
References fb(), mkdir, and pg_dir_create_mode.
Referenced by bbsink_server_new(), copydir(), create_tablespace_directories(), CreateDirAndVersionFile(), CreateSlotOnDisk(), OpenTemporaryFileInTablespace(), PathNameCreateTemporaryDir(), SysLogger_Start(), SysLoggerMain(), TablespaceCreateDbspace(), test_slru_shmem_startup(), and ValidateXLOGDirectoryStructure().
Definition at line 2730 of file fd.c.
References allocatedDescs, AllocateDescPipe, AllocateDesc::create_subid, AllocateDesc::desc, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, fb(), AllocateDesc::file, GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, mode, numAllocatedDescs, pqsignal, ReleaseLruFile(), ReleaseLruFiles(), reserveAllocatedDesc(), and SIGPIPE.
Referenced by BeginCopyFrom(), BeginCopyTo(), pg_import_system_collations(), run_ssl_passphrase_command(), and shell_run_command().
Definition at line 1711 of file fd.c.
References Assert, CurrentResourceOwner, fb(), FD_DELETE_AT_CLOSE, FD_TEMP_FILE_LIMIT, vfd::fdstate, GetNextTempTableSpace(), MyDatabaseTableSpace, numTempTableSpaces, OidIsValid, OpenTemporaryFileInTablespace(), RegisterTemporaryFile(), ResourceOwnerEnlarge(), and VfdCache.
Referenced by BufFileCreateTemp(), and extendBufFile().
Definition at line 1791 of file fd.c.
References elog, ERROR, fb(), MakePGDirectory(), MAXPGPATH, MyProcPid, PathNameOpenFile(), PG_BINARY, PG_TEMP_FILE_PREFIX, snprintf, tempFileCounter, and TempTablespacePath().
Referenced by OpenTemporaryFile().
Definition at line 2677 of file fd.c.
References OpenTransientFilePerm(), and pg_file_create_mode.
Referenced by ApplyLogicalMappingFile(), CheckPointLogicalRewriteHeap(), CheckPointReplicationOrigin(), clone_file(), compare_files(), copy_file(), CreateDirAndVersionFile(), dsm_impl_mmap(), durable_rename(), fsync_fname_ext(), get_controlfile_by_exact_path(), heap_xlog_logical_rewrite(), lo_import_internal(), perform_base_backup(), pg_truncate(), qtext_load_file(), qtext_store(), read_relmap_file(), ReadTwoPhaseFile(), RecreateTwoPhaseFile(), ReorderBufferSerializeTXN(), RestoreSlotFromDisk(), SaveSlotToPath(), sendFile(), SendTimeLineHistory(), SimpleLruDoesPhysicalPageExist(), SlruPhysicalReadPage(), SlruPhysicalWritePage(), SlruSyncFileTag(), SnapBuildRestoreSnapshot(), SnapBuildSerialize(), StartupReplicationOrigin(), write_relmap_file(), writeTimeLineHistory(), writeTimeLineHistoryFile(), and XLogFileCopy().
Definition at line 2686 of file fd.c.
References allocatedDescs, AllocateDescRawFD, BasicOpenFilePerm(), AllocateDesc::create_subid, AllocateDesc::desc, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, fb(), AllocateDesc::fd, fd(), GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, numAllocatedDescs, ReleaseLruFiles(), and reserveAllocatedDesc().
Referenced by be_lo_export(), and OpenTransientFile().
Definition at line 1647 of file fd.c.
References basedir, directory, ereport, errcode_for_file_access(), errmsg(), ERROR, fb(), and MakePGDirectory().
Referenced by FileSetCreate().
Definition at line 1848 of file fd.c.
References Assert, CurrentResourceOwner, ereport, errcode_for_file_access(), errmsg(), ERROR, fb(), FD_TEMP_FILE_LIMIT, vfd::fdstate, PathNameOpenFile(), PG_BINARY, RegisterTemporaryFile(), ResourceOwnerEnlarge(), and VfdCache.
Referenced by FileSetCreate().
Definition at line 1678 of file fd.c.
References fb(), LOG, stat, unlink_if_exists_fname(), and walkdir().
Referenced by FileSetDeleteAll().
Definition at line 1919 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), ERROR, fb(), LOG, ReportTemporaryFileUsage(), and stat.
Referenced by FileSetDelete(), and unlink_if_exists_fname().
Definition at line 1562 of file fd.c.
References PathNameOpenFilePerm(), and pg_file_create_mode.
Referenced by _mdfd_openseg(), bbsink_server_begin_archive(), bbsink_server_begin_manifest(), logical_rewrite_log_mapping(), mdcreate(), mdopenfork(), mdsyncfiletag(), OpenTemporaryFileInTablespace(), OpenWalSummaryFile(), PathNameCreateTemporaryFile(), PathNameOpenTemporaryFile(), ReorderBufferRestoreChanges(), and SummarizeWAL().
Definition at line 1575 of file fd.c.
References AllocateVfd(), BasicOpenFilePerm(), DO_DB, elog, ereport, errcode(), errmsg(), ERROR, fb(), free, FreeVfd(), Insert(), LOG, nfile, O_CLOEXEC, ReleaseLruFiles(), and VfdCache.
Referenced by PathNameOpenFile().
Definition at line 1888 of file fd.c.
References Assert, CurrentResourceOwner, ereport, errcode_for_file_access(), errmsg(), ERROR, fb(), mode, PathNameOpenFile(), PG_BINARY, RegisterTemporaryFile(), and ResourceOwnerEnlarge().
Referenced by FileSetOpen().
Definition at line 480 of file fd.c.
References EINTR, enableFsync, fb(), fd(), and fdatasync().
Referenced by issue_xlog_fsync().
Definition at line 503 of file fd.c.
References Assert, ereport, errcode_for_file_access(), errmsg(), ERROR, fb(), name, S_ISDIR, stat::st_mode, and stat.
Referenced by expand_dynamic_library_name(), find_in_path(), find_in_paths(), and provider_init().
Definition at line 525 of file fd.c.
References data_sync_elevel(), EINTR, enableFsync, ereport, errcode_for_file_access(), errmsg(), FATAL, fb(), fd(), MAP_FAILED, and WARNING.
Referenced by copy_file(), and FileWriteback().
Definition at line 389 of file fd.c.
References Assert, fb(), fd(), fstat, pg_fsync_no_writethrough(), pg_fsync_writethrough(), S_ISDIR, stat::st_mode, wal_sync_method, and WAL_SYNC_METHOD_FSYNC_WRITETHROUGH.
Referenced by AddToDataDirLockFile(), assign_wal_sync_method(), BootStrapXLOG(), CheckPointLogicalRewriteHeap(), CreateDirAndVersionFile(), CreateLockFile(), durable_rename(), FileSync(), fsync_fname_ext(), heap_xlog_logical_rewrite(), readRecoverySignalFile(), RecreateTwoPhaseFile(), RestoreSlotFromDisk(), SaveSlotToPath(), SlruPhysicalWritePage(), SlruSyncFileTag(), SnapBuildSerialize(), update_controlfile(), write_auto_conf_file(), WriteControlFile(), writeTimeLineHistory(), writeTimeLineHistoryFile(), XLogFileCopy(), and XLogFileInitInternal().
Definition at line 441 of file fd.c.
References EINTR, enableFsync, fb(), fd(), and fsync.
Referenced by issue_xlog_fsync(), and pg_fsync().
Definition at line 461 of file fd.c.
References enableFsync, fb(), and fd().
Referenced by issue_xlog_fsync(), pg_fsync(), and test_sync().
Definition at line 720 of file fd.c.
References CloseTransientFile(), EINTR, fb(), fd(), OpenTransientFile(), PG_BINARY, and pg_ftruncate().
Referenced by do_truncate().
Definition at line 2956 of file fd.c.
References ERROR, and ReadDirExtended().
Referenced by calculate_database_size(), calculate_tablespace_size(), CheckPointLogicalRewriteHeap(), CheckPointSnapBuild(), CheckTablespaceDirectory(), CleanupBackupHistory(), copydir(), db_dir_size(), destroy_tablespace_directories(), directory_is_empty(), do_pg_backup_start(), dsm_cleanup_for_mmap(), extension_file_exists(), get_ext_ver_list(), GetConfFilesInDir(), GetWalSummaries(), movedb(), perform_base_backup(), pg_available_extension_versions(), pg_available_extensions(), pg_ls_dir(), pg_ls_dir_files(), pg_tablespace_databases(), pg_tzenumerate_next(), pgarch_readyXlog(), RemoveNonParentXlogFiles(), RemoveOldXlogFiles(), RemoveTempXlogFiles(), ResetUnloggedRelations(), ResetUnloggedRelationsInDbspaceDir(), ResetUnloggedRelationsInTablespaceDir(), restoreTwoPhaseData(), sendDir(), SlruScanDirectory(), StartupReorderBuffer(), StartupReplicationSlots(), UpdateLogicalMappings(), and XLogGetOldestSegno().
Definition at line 2971 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), fb(), and readdir().
Referenced by DeleteAllExportedSnapshotFiles(), ReadDir(), RelationCacheInitFileRemove(), RelationCacheInitFileRemoveInDir(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePgTempRelationFiles(), RemovePgTempRelationFilesInDbspace(), ReorderBufferCleanupSerializedTXNs(), scan_directory_ci(), SyncDataDirectory(), and walkdir().
Definition at line 1534 of file fd.c.
References CurrentResourceOwner, FD_CLOSE_AT_EOXACT, vfd::fdstate, have_xact_temporary_files, ResourceOwnerRememberFile(), vfd::resowner, and VfdCache.
Referenced by OpenTemporaryFile(), PathNameCreateTemporaryFile(), and PathNameOpenTemporaryFile().
Definition at line 1224 of file fd.c.
References Assert, and numExternalFDs.
Referenced by ClosePostmasterPorts(), CreateWaitEventSet(), dsm_impl_posix(), FreeWaitEventSet(), FreeWaitEventSetAfterFork(), InitializeWaitEventSupport(), libpqsrv_connect_internal(), libpqsrv_disconnect(), and XLogFileClose().
Definition at line 1369 of file fd.c.
References Assert, DO_DB, elog, LOG, LruDelete(), nfile, and VfdCache.
Referenced by AllocateDir(), AllocateFile(), BasicOpenFilePerm(), OpenPipeStream(), and ReleaseLruFiles().
Definition at line 1391 of file fd.c.
References max_safe_fds, nfile, numAllocatedDescs, numExternalFDs, and ReleaseLruFile().
Referenced by AllocateDir(), AllocateFile(), LruInsert(), OpenPipeStream(), OpenTransientFilePerm(), PathNameOpenFilePerm(), and ReserveExternalFD().
Definition at line 3322 of file fd.c.
References AllocateDir(), fb(), FreeDir(), LOG, MAXPGPATH, PG_TBLSPC_DIR, PG_TEMP_FILES_DIR, ReadDirExtended(), RemovePgTempFilesInDir(), RemovePgTempRelationFiles(), snprintf, and TABLESPACE_VERSION_DIRECTORY.
Referenced by PostmasterMain(), and PostmasterStateMachine().
Definition at line 3382 of file fd.c.
References AllocateDir(), ereport, errcode_for_file_access(), errmsg(), fb(), FreeDir(), get_dirent_type(), LOG, MAXPGPATH, PG_TEMP_FILE_PREFIX, PGFILETYPE_DIR, PGFILETYPE_ERROR, ReadDirExtended(), RemovePgTempFilesInDir(), snprintf, and type.
Referenced by PostmasterMain(), RemovePgTempFiles(), and RemovePgTempFilesInDir().
Definition at line 3442 of file fd.c.
References AllocateDir(), fb(), FreeDir(), LOG, MAXPGPATH, ReadDirExtended(), RemovePgTempRelationFilesInDbspace(), and snprintf.
Referenced by RemovePgTempFiles().
Definition at line 3470 of file fd.c.
References AllocateDir(), ereport, errcode_for_file_access(), errmsg(), fb(), FreeDir(), LOG, looks_like_temp_rel_name(), MAXPGPATH, ReadDirExtended(), and snprintf.
Referenced by RemovePgTempRelationFiles().
Definition at line 1515 of file fd.c.
References ereport, errmsg(), LOG, log_temp_files, and pgstat_report_tempfile().
Referenced by FileClose(), and PathNameDeleteTemporaryFile().
Definition at line 2552 of file fd.c.
References allocatedDescs, ereport, errcode(), errmsg(), ERROR, fb(), FD_MINFREE, malloc, max_safe_fds, maxAllocatedDescs, numAllocatedDescs, and realloc.
Referenced by AllocateDir(), AllocateFile(), OpenPipeStream(), and OpenTransientFilePerm().
Definition at line 1206 of file fd.c.
References numExternalFDs, and ReleaseLruFiles().
Referenced by AcquireExternalFD(), BackendInitialize(), dsm_impl_posix(), InitializeWaitEventSupport(), InitPostmasterDeathWatchHandle(), and XLogWrite().
|
inlinestatic |
Definition at line 380 of file fd.c.
References file_resowner_desc, Int32GetDatum(), and ResourceOwnerForget().
Referenced by FileClose().
|
inlinestatic |
Definition at line 375 of file fd.c.
References file_resowner_desc, Int32GetDatum(), and ResourceOwnerRemember().
Referenced by RegisterTemporaryFile().
Definition at line 4102 of file fd.c.
References DatumGetInt32(), and psprintf().
Definition at line 4088 of file fd.c.
References Assert, DatumGetInt32(), fb(), FileClose(), FileIsValid, vfd::resowner, and VfdCache.
Definition at line 1044 of file fd.c.
References count_usable_fds(), DEBUG2, elog, ereport, errcode(), errdetail(), errmsg(), FATAL, fb(), FD_MINFREE, max_files_per_process, max_safe_fds, Min, and NUM_RESERVED_FDS.
Referenced by BootstrapModeMain(), PostgresSingleUserMain(), and PostmasterMain().
Definition at line 3096 of file fd.c.
References Assert, fb(), nextTempTableSpace, numTempTableSpaces, pg_global_prng_state, pg_prng_uint64_range(), and tempTableSpaces.
Referenced by assign_temp_tablespaces(), and PrepareTempTablespaces().
Definition at line 3593 of file fd.c.
References AllocateDir(), begin_startup_progress_phase(), DATA_DIR_SYNC_METHOD_SYNCFS, datadir_fsync_fname(), DEBUG1, enableFsync, ereport, errcode_for_file_access(), errmsg(), fb(), FreeDir(), LOG, lstat, MAXPGPATH, PG_TBLSPC_DIR, ReadDirExtended(), recovery_init_sync_method, S_ISLNK, snprintf, stat::st_mode, and walkdir().
Referenced by StartupXLOG().
Definition at line 1766 of file fd.c.
References fb(), InvalidOid, MAXPGPATH, PG_TBLSPC_DIR, PG_TEMP_FILES_DIR, snprintf, tablespace, and TABLESPACE_VERSION_DIRECTORY.
Referenced by FileSetCreate(), FileSetPath(), OpenTemporaryFileInTablespace(), and pg_ls_tmpdir().
Definition at line 3125 of file fd.c.
References numTempTableSpaces.
Referenced by GetTempTablespaces(), and PrepareTempTablespaces().
Definition at line 3821 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), fb(), and PathNameDeleteTemporaryFile().
Referenced by PathNameDeleteTemporaryDir().
|
static |
Definition at line 3707 of file fd.c.
References AllocateDir(), CHECK_FOR_INTERRUPTS, fb(), FreeDir(), get_dirent_type(), MAXPGPATH, PGFILETYPE_DIR, PGFILETYPE_REG, ReadDirExtended(), snprintf, subpath(), and walkdir().
Referenced by PathNameDeleteTemporaryDir(), SyncDataDirectory(), and walkdir().
|
static |
Definition at line 272 of file fd.c.
Referenced by AllocateDir(), AllocateFile(), AtEOSubXact_Files(), CleanupTempFiles(), ClosePipeStream(), CloseTransientFile(), FreeDesc(), FreeDir(), FreeFile(), OpenPipeStream(), OpenTransientFilePerm(), and reserveAllocatedDesc().
Definition at line 162 of file fd.c.
Referenced by data_sync_elevel().
| int file_extend_method = DEFAULT_FILE_EXTEND_METHOD |
Definition at line 168 of file fd.c.
Referenced by mdzeroextend().
|
static |
Definition at line 364 of file fd.c.
Referenced by ResourceOwnerForgetFile(), and ResourceOwnerRememberFile().
Definition at line 231 of file fd.c.
Referenced by CleanupTempFiles(), and RegisterTemporaryFile().
| int io_direct_flags |
Definition at line 171 of file fd.c.
Referenced by _mdfd_open_flags(), assign_debug_io_direct(), get_sync_bit(), mdprefetch(), mdstartreadv(), mdwriteback(), PrefetchLocalBuffer(), PrefetchSharedBuffer(), read_stream_begin_impl(), ScheduleBufferTagForWriteback(), XLogFileClose(), XLogFileInitInternal(), and XLogPrefetcherNextBlock().
| int max_files_per_process = 1000 |
Definition at line 146 of file fd.c.
Referenced by set_max_safe_fds().
| int max_safe_fds = FD_MINFREE |
Definition at line 159 of file fd.c.
Referenced by AcquireExternalFD(), ReleaseLruFiles(), reserveAllocatedDesc(), and set_max_safe_fds().
|
static |
Definition at line 271 of file fd.c.
Referenced by AllocateDir(), AllocateFile(), OpenPipeStream(), OpenTransientFilePerm(), and reserveAllocatedDesc().
|
static |
Definition at line 293 of file fd.c.
Referenced by GetNextTempTableSpace(), and SetTempTablespaces().
|
static |
Definition at line 225 of file fd.c.
Referenced by FileClose(), LruDelete(), LruInsert(), PathNameOpenFilePerm(), ReleaseLruFile(), and ReleaseLruFiles().
|
static |
Definition at line 270 of file fd.c.
Referenced by AllocateDir(), AllocateFile(), AtEOSubXact_Files(), CleanupTempFiles(), ClosePipeStream(), CloseTransientFile(), FreeDesc(), FreeDir(), FreeFile(), OpenPipeStream(), OpenTransientFilePerm(), ReleaseLruFiles(), and reserveAllocatedDesc().
|
static |
Definition at line 277 of file fd.c.
Referenced by AcquireExternalFD(), ReleaseExternalFD(), ReleaseLruFiles(), and ReserveExternalFD().
|
static |
Definition at line 292 of file fd.c.
Referenced by AtEOXact_Files(), GetNextTempTableSpace(), GetTempTablespaces(), OpenTemporaryFile(), SetTempTablespaces(), and TempTablespacesAreSet().
| int recovery_init_sync_method = DATA_DIR_SYNC_METHOD_FSYNC |
Definition at line 165 of file fd.c.
Referenced by SyncDataDirectory().
|
static |
Definition at line 220 of file fd.c.
Referenced by AllocateVfd(), CleanupTempFiles(), closeAllVfds(), InitFileAccess(), and InitTemporaryFileAccess().
|
static |
Definition at line 283 of file fd.c.
Referenced by OpenTemporaryFileInTablespace().
|
static |
Definition at line 239 of file fd.c.
Referenced by FileClose(), FileTruncate(), and FileWriteV().
Definition at line 291 of file fd.c.
Referenced by AtEOXact_Files(), GetNextTempTableSpace(), GetTempTablespaces(), and SetTempTablespaces().
|
static |
Definition at line 219 of file fd.c.
Referenced by AllocateVfd(), CleanupTempFiles(), Delete(), FileAccess(), FileClose(), FileFallocate(), FileGetRawDesc(), FileGetRawFlags(), FileGetRawMode(), FilePathName(), FilePrefetch(), FileReadV(), FileSize(), FileStartReadV(), FileSync(), FileTruncate(), FileWriteback(), FileWriteV(), FileZero(), FreeVfd(), InitFileAccess(), Insert(), LruDelete(), LruInsert(), OpenTemporaryFile(), PathNameCreateTemporaryFile(), PathNameOpenFilePerm(), RegisterTemporaryFile(), ReleaseLruFile(), and ResOwnerReleaseFile().