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/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 } |
Functions | |
static void | Delete (File file) |
static void | LruDelete (File file) |
static void | Insert (File file) |
static int | LruInsert (File file) |
static bool | ReleaseLruFile (void) |
static void | ReleaseLruFiles (void) |
static File | AllocateVfd (void) |
static void | FreeVfd (File file) |
static int | FileAccess (File file) |
static File | OpenTemporaryFileInTablespace (Oid tblspcOid, bool rejectError) |
static bool | reserveAllocatedDesc (void) |
static int | FreeDesc (AllocateDesc *desc) |
static void | BeforeShmemExit_Files (int code, Datum arg) |
static void | CleanupTempFiles (bool isCommit, bool isProcExit) |
static void | RemovePgTempRelationFiles (const char *tsdirname) |
static void | RemovePgTempRelationFilesInDbspace (const char *dbspacedirname) |
static void | walkdir (const char *path, void(*action)(const char *fname, bool isdir, int elevel), bool process_symlinks, int elevel) |
static void | datadir_fsync_fname (const char *fname, bool isdir, int elevel) |
static void | unlink_if_exists_fname (const char *fname, bool isdir, int elevel) |
static int | fsync_parent_path (const char *fname, int elevel) |
static void | ResOwnerReleaseFile (Datum res) |
static char * | ResOwnerPrintFile (Datum res) |
static void | ResourceOwnerRememberFile (ResourceOwner owner, File file) |
static void | ResourceOwnerForgetFile (ResourceOwner owner, File file) |
int | pg_fsync (int fd) |
int | pg_fsync_no_writethrough (int fd) |
int | pg_fsync_writethrough (int fd) |
int | pg_fdatasync (int fd) |
bool | pg_file_exists (const char *name) |
void | pg_flush_data (int fd, off_t offset, off_t nbytes) |
static int | pg_ftruncate (int fd, off_t length) |
int | pg_truncate (const char *path, off_t length) |
void | fsync_fname (const char *fname, bool isdir) |
int | durable_rename (const char *oldfile, const char *newfile, int elevel) |
int | durable_unlink (const char *fname, int elevel) |
void | InitFileAccess (void) |
void | InitTemporaryFileAccess (void) |
static void | count_usable_fds (int max_to_probe, int *usable_fds, int *already_open) |
void | set_max_safe_fds (void) |
int | BasicOpenFile (const char *fileName, int fileFlags) |
int | BasicOpenFilePerm (const char *fileName, int fileFlags, mode_t fileMode) |
bool | AcquireExternalFD (void) |
void | ReserveExternalFD (void) |
void | ReleaseExternalFD (void) |
static void | ReportTemporaryFileUsage (const char *path, off_t size) |
static void | RegisterTemporaryFile (File file) |
File | PathNameOpenFile (const char *fileName, int fileFlags) |
File | PathNameOpenFilePerm (const char *fileName, int fileFlags, mode_t fileMode) |
void | PathNameCreateTemporaryDir (const char *basedir, const char *directory) |
void | PathNameDeleteTemporaryDir (const char *dirname) |
File | OpenTemporaryFile (bool interXact) |
void | TempTablespacePath (char *path, Oid tablespace) |
File | PathNameCreateTemporaryFile (const char *path, bool error_on_failure) |
File | PathNameOpenTemporaryFile (const char *path, int mode) |
bool | PathNameDeleteTemporaryFile (const char *path, bool error_on_failure) |
void | FileClose (File file) |
int | FilePrefetch (File file, off_t offset, off_t amount, uint32 wait_event_info) |
void | FileWriteback (File file, off_t offset, off_t nbytes, uint32 wait_event_info) |
ssize_t | FileReadV (File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info) |
ssize_t | FileWriteV (File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info) |
int | FileSync (File file, uint32 wait_event_info) |
int | FileZero (File file, off_t offset, off_t amount, uint32 wait_event_info) |
int | FileFallocate (File file, off_t offset, off_t amount, uint32 wait_event_info) |
off_t | FileSize (File file) |
int | FileTruncate (File file, off_t offset, uint32 wait_event_info) |
char * | FilePathName (File file) |
int | FileGetRawDesc (File file) |
int | FileGetRawFlags (File file) |
mode_t | FileGetRawMode (File file) |
FILE * | AllocateFile (const char *name, const char *mode) |
int | OpenTransientFile (const char *fileName, int fileFlags) |
int | OpenTransientFilePerm (const char *fileName, int fileFlags, mode_t fileMode) |
FILE * | OpenPipeStream (const char *command, const char *mode) |
int | FreeFile (FILE *file) |
int | CloseTransientFile (int fd) |
DIR * | AllocateDir (const char *dirname) |
struct dirent * | ReadDir (DIR *dir, const char *dirname) |
struct dirent * | ReadDirExtended (DIR *dir, const char *dirname, int elevel) |
int | FreeDir (DIR *dir) |
int | ClosePipeStream (FILE *file) |
void | closeAllVfds (void) |
void | SetTempTablespaces (Oid *tableSpaces, int numSpaces) |
bool | TempTablespacesAreSet (void) |
int | GetTempTablespaces (Oid *tableSpaces, int numSpaces) |
Oid | GetNextTempTableSpace (void) |
void | AtEOSubXact_Files (bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid) |
void | AtEOXact_Files (bool isCommit) |
void | RemovePgTempFiles (void) |
void | RemovePgTempFilesInDir (const char *tmpdirname, bool missing_ok, bool unlink_all) |
bool | looks_like_temp_rel_name (const char *name) |
void | SyncDataDirectory (void) |
int | fsync_fname_ext (const char *fname, bool isdir, bool ignore_perm, int elevel) |
int | MakePGDirectory (const char *directoryName) |
int | data_sync_elevel (int elevel) |
bool | check_debug_io_direct (char **newval, void **extra, GucSource source) |
void | assign_debug_io_direct (const char *newval, void *extra) |
Variables | |
int | max_files_per_process = 1000 |
int | max_safe_fds = FD_MINFREE |
bool | data_sync_retry = false |
int | recovery_init_sync_method = DATA_DIR_SYNC_METHOD_FSYNC |
int | io_direct_flags |
static Vfd * | VfdCache |
static Size | SizeVfdCache = 0 |
static int | nfile = 0 |
static bool | have_xact_temporary_files = false |
static uint64 | temporary_files_size = 0 |
static int | numAllocatedDescs = 0 |
static int | maxAllocatedDescs = 0 |
static AllocateDesc * | allocatedDescs = NULL |
static int | numExternalFDs = 0 |
static long | tempFileCounter = 0 |
static Oid * | tempTableSpaces = NULL |
static int | numTempTableSpaces = -1 |
static int | nextTempTableSpace = 0 |
static const ResourceOwnerDesc | file_resowner_desc |
#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) |
enum AllocateDescKind |
bool AcquireExternalFD | ( | void | ) |
Definition at line 1185 of file fd.c.
References max_safe_fds, numExternalFDs, and ReserveExternalFD().
Referenced by CreateWaitEventSet(), and libpqsrv_connect_prepare().
DIR* AllocateDir | ( | const char * | dirname | ) |
Definition at line 2865 of file fd.c.
References allocatedDescs, AllocateDescDir, AllocateDesc::create_subid, AllocateDesc::desc, AllocateDesc::dir, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, 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().
FILE* AllocateFile | ( | const char * | name, |
const char * | mode | ||
) |
Definition at line 2605 of file fd.c.
References allocatedDescs, AllocateDescFile, AllocateDesc::create_subid, AllocateDesc::desc, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, 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(), 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(), tsearch_readline_begin(), ValidatePgVersion(), write_relcache_init_file(), XLogArchiveForceDone(), and XLogArchiveNotify().
|
static |
Definition at line 1413 of file fd.c.
References Assert, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, vfd::fd, i, LOG, MemSet, vfd::nextFree, realloc, SizeVfdCache, VFD_CLOSED, and VfdCache.
Referenced by PathNameOpenFilePerm().
void assign_debug_io_direct | ( | const char * | newval, |
void * | extra | ||
) |
void AtEOSubXact_Files | ( | bool | isCommit, |
SubTransactionId | mySubid, | ||
SubTransactionId | parentSubid | ||
) |
Definition at line 3154 of file fd.c.
References allocatedDescs, AllocateDesc::create_subid, FreeDesc(), i, and numAllocatedDescs.
Referenced by AbortSubTransaction(), and CommitSubTransaction().
void AtEOXact_Files | ( | bool | isCommit | ) |
Definition at line 3187 of file fd.c.
References CleanupTempFiles(), numTempTableSpaces, and tempTableSpaces.
Referenced by AbortTransaction(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), pgarch_archiveXlog(), PrepareTransaction(), WalSummarizerMain(), and WalWriterMain().
int BasicOpenFile | ( | const char * | fileName, |
int | fileFlags | ||
) |
Definition at line 1086 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().
int BasicOpenFilePerm | ( | const char * | fileName, |
int | fileFlags, | ||
mode_t | fileMode | ||
) |
Definition at line 1108 of file fd.c.
References close, ereport, errcode(), errmsg(), fd(), LOG, O_CLOEXEC, O_DSYNC, PG_O_DIRECT, ReleaseLruFile(), and StaticAssertStmt.
Referenced by BasicOpenFile(), LruInsert(), OpenTransientFilePerm(), PathNameOpenFilePerm(), and readRecoverySignalFile().
|
static |
Definition at line 3201 of file fd.c.
References CleanupTempFiles().
Referenced by InitTemporaryFileAccess().
Definition at line 3965 of file fd.c.
References ERROR, GUC_check_errdetail, guc_malloc(), IO_DIRECT_DATA, IO_DIRECT_WAL, IO_DIRECT_WAL_INIT, lfirst, list_free(), newval, pfree(), pg_strcasecmp(), pstrdup(), and SplitGUCList().
Definition at line 3224 of file fd.c.
References allocatedDescs, Assert, elog, 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().
void closeAllVfds | ( | void | ) |
Definition at line 3042 of file fd.c.
References Assert, FileIsNotOpen, i, LruDelete(), and SizeVfdCache.
Referenced by standard_ProcessUtility().
int ClosePipeStream | ( | FILE * | file | ) |
Definition at line 3013 of file fd.c.
References allocatedDescs, AllocateDescPipe, AllocateDesc::desc, DO_DB, elog, 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().
int CloseTransientFile | ( | int | fd | ) |
Definition at line 2831 of file fd.c.
References allocatedDescs, AllocateDescRawFD, close, AllocateDesc::desc, DO_DB, elog, AllocateDesc::fd, fd(), FreeDesc(), i, AllocateDesc::kind, LOG, numAllocatedDescs, and WARNING.
Referenced by ApplyLogicalMappingFile(), be_lo_export(), CheckPointLogicalRewriteHeap(), CheckPointReplicationOrigin(), 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().
|
static |
int data_sync_elevel | ( | int | elevel | ) |
Definition at line 3959 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().
|
static |
Definition at line 3782 of file fd.c.
References ereport_startup_progress, and fsync_fname_ext().
Referenced by SyncDataDirectory().
|
static |
Definition at line 1267 of file fd.c.
References Assert, DO_DB, elog, LOG, vfd::lruLessRecently, vfd::lruMoreRecently, and VfdCache.
Referenced by FileAccess(), FileClose(), and LruDelete().
int durable_rename | ( | const char * | oldfile, |
const char * | newfile, | ||
int | elevel | ||
) |
Definition at line 781 of file fd.c.
References CloseTransientFile(), ereport, errcode_for_file_access(), errmsg(), 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(), CleanupAfterArchiveRecovery(), dir_close(), InitWalRecovery(), InstallXLogFileSegment(), KeepFileRestoredFromArchive(), pgss_shmem_shutdown(), pgstat_write_statsfile(), StartupXLOG(), SummarizeWAL(), write_relmap_file(), writeTimeLineHistory(), writeTimeLineHistoryFile(), and XLogArchiveForceDone().
int durable_unlink | ( | const char * | fname, |
int | elevel | ||
) |
Definition at line 871 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), and fsync_parent_path().
Referenced by InstallXLogFileSegment(), RemoveXlogFile(), and StartupXLOG().
|
static |
Definition at line 1491 of file fd.c.
References Delete(), DO_DB, elog, FileIsNotOpen, Insert(), LOG, LruInsert(), and VfdCache.
Referenced by FileFallocate(), FilePrefetch(), FileReadV(), FileSize(), FileSync(), FileTruncate(), FileWriteback(), FileWriteV(), and FileZero().
void FileClose | ( | File | file | ) |
Definition at line 1977 of file fd.c.
References Assert, close, data_sync_elevel(), Delete(), DO_DB, elog, ereport, errcode_for_file_access(), errmsg(), vfd::fd, FD_DELETE_AT_CLOSE, FD_TEMP_FILE_LIMIT, vfd::fdstate, FileIsNotOpen, FileIsValid, vfd::fileName, vfd::fileSize, FreeVfd(), LOG, nfile, ReportTemporaryFileUsage(), ResourceOwnerForgetFile(), vfd::resowner, stat::st_size, 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 2391 of file fd.c.
References Assert, DO_DB, EINTR, elog, EOPNOTSUPP, fd(), FileAccess(), FileIsValid, FileZero(), INT64_FORMAT, LOG, pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by mdzeroextend().
int FileGetRawDesc | ( | File | file | ) |
int FileGetRawFlags | ( | File | file | ) |
mode_t FileGetRawMode | ( | File | file | ) |
char* FilePathName | ( | File | file | ) |
Definition at line 2483 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(), mdsyncfiletag(), mdtruncate(), mdwritev(), mdzeroextend(), pg_wal_summary_contents(), PrepareForIncrementalBackup(), ReadWalSummary(), register_dirty_segment(), and WriteWalSummary().
Definition at line 2076 of file fd.c.
References Assert, DO_DB, EINTR, elog, 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, | ||
off_t | offset, | ||
uint32 | wait_event_info | ||
) |
Definition at line 2158 of file fd.c.
References _dosmaperr(), Assert, DO_DB, EINTR, elog, error(), vfd::fd, FileAccess(), FileIsValid, INT64_FORMAT, LOG, pg_preadv(), pg_usleep(), pgstat_report_wait_end(), pgstat_report_wait_start(), and VfdCache.
Referenced by FileRead(), and mdreadv().
off_t FileSize | ( | File | file | ) |
Definition at line 2431 of file fd.c.
References Assert, DO_DB, elog, fd(), FileAccess(), FileIsNotOpen, FileIsValid, LOG, and VfdCache.
Referenced by _mdnblocks(), BufFileSeek(), and BufFileSize().
Definition at line 2319 of file fd.c.
References Assert, DO_DB, elog, 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 2448 of file fd.c.
References Assert, DO_DB, elog, 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 2132 of file fd.c.
References Assert, DO_DB, elog, 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, | ||
off_t | offset, | ||
uint32 | wait_event_info | ||
) |
Definition at line 2214 of file fd.c.
References _dosmaperr(), Assert, DO_DB, EINTR, elog, ereport, errcode(), errmsg(), ERROR, error(), vfd::fd, FD_TEMP_FILE_LIMIT, vfd::fdstate, 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 2346 of file fd.c.
References Assert, DO_DB, elog, 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 2764 of file fd.c.
References allocatedDescs, AllocateDescDir, AllocateDescFile, AllocateDescPipe, AllocateDescRawFD, close, closedir(), AllocateDesc::desc, AllocateDesc::dir, elog, ERROR, AllocateDesc::fd, AllocateDesc::file, AllocateDesc::kind, and numAllocatedDescs.
Referenced by AtEOSubXact_Files(), CleanupTempFiles(), ClosePipeStream(), CloseTransientFile(), FreeDir(), and FreeFile().
int FreeDir | ( | DIR * | dir | ) |
Definition at line 2983 of file fd.c.
References allocatedDescs, AllocateDescDir, closedir(), AllocateDesc::desc, AllocateDesc::dir, DO_DB, elog, 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().
int FreeFile | ( | FILE * | file | ) |
Definition at line 2803 of file fd.c.
References allocatedDescs, AllocateDescFile, AllocateDesc::desc, DO_DB, elog, 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(), 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(), tsearch_readline_end(), ValidatePgVersion(), write_relcache_init_file(), XLogArchiveForceDone(), and XLogArchiveNotify().
|
static |
Definition at line 1471 of file fd.c.
References DO_DB, elog, vfd::fdstate, vfd::fileName, free, LOG, vfd::nextFree, and VfdCache.
Referenced by FileClose(), and PathNameOpenFilePerm().
void fsync_fname | ( | const char * | fname, |
bool | isdir | ||
) |
Definition at line 755 of file fd.c.
References data_sync_elevel(), ERROR, and fsync_fname_ext().
Referenced by _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(), and tar_finish().
Definition at line 3820 of file fd.c.
References CloseTransientFile(), ereport, errcode_for_file_access(), errmsg(), fd(), OpenTransientFile(), PG_BINARY, and pg_fsync().
Referenced by datadir_fsync_fname(), durable_rename(), fsync_fname(), and fsync_parent_path().
|
static |
Definition at line 3896 of file fd.c.
References fsync_fname_ext(), get_parent_directory(), MAXPGPATH, and strlcpy().
Referenced by dir_close(), dir_open_for_write(), durable_rename(), durable_unlink(), and tar_finish().
Oid GetNextTempTableSpace | ( | void | ) |
Definition at line 3133 of file fd.c.
References InvalidOid, nextTempTableSpace, numTempTableSpaces, and tempTableSpaces.
Referenced by GetDefaultTablespace(), and OpenTemporaryFile().
int GetTempTablespaces | ( | Oid * | tableSpaces, |
int | numSpaces | ||
) |
Definition at line 3115 of file fd.c.
References Assert, i, numTempTableSpaces, tempTableSpaces, and TempTablespacesAreSet().
Referenced by FileSetInit().
void InitFileAccess | ( | void | ) |
Definition at line 902 of file fd.c.
References Assert, ereport, errcode(), errmsg(), FATAL, vfd::fd, malloc, MemSet, SizeVfdCache, VFD_CLOSED, and VfdCache.
Referenced by BaseInit().
void InitTemporaryFileAccess | ( | void | ) |
Definition at line 932 of file fd.c.
References Assert, before_shmem_exit(), BeforeShmemExit_Files(), and SizeVfdCache.
Referenced by BaseInit().
|
static |
Definition at line 1312 of file fd.c.
References Assert, DO_DB, elog, LOG, vfd::lruLessRecently, vfd::lruMoreRecently, and VfdCache.
Referenced by AdvanceXLInsertBuffer(), CreateCheckPoint(), FileAccess(), GetXLogInsertRecPtr(), LruInsert(), PathNameOpenFilePerm(), ReserveXLogInsertLocation(), ReserveXLogSwitch(), StartupXLOG(), UpdateFullPageWrites(), WaitXLogInsertionsToFinish(), XLogInsertRecord(), and XLogWrite().
bool looks_like_temp_rel_name | ( | const char * | name | ) |
Definition at line 3472 of file fd.c.
References forkname_chars(), and name.
Referenced by RemovePgTempRelationFilesInDbspace(), and sendDir().
|
static |
Definition at line 1286 of file fd.c.
References Assert, close, data_sync_elevel(), Delete(), DO_DB, elog, vfd::fd, FD_TEMP_FILE_LIMIT, vfd::fdstate, vfd::fileName, LOG, nfile, VFD_CLOSED, and VfdCache.
Referenced by closeAllVfds(), and ReleaseLruFile().
|
static |
Definition at line 1334 of file fd.c.
References Assert, BasicOpenFilePerm(), DO_DB, elog, vfd::fd, vfd::fileFlags, FileIsNotOpen, vfd::fileMode, vfd::fileName, Insert(), LOG, nfile, ReleaseLruFiles(), and VfdCache.
Referenced by FileAccess().
int MakePGDirectory | ( | const char * | directoryName | ) |
Definition at line 3936 of file fd.c.
References 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().
FILE* OpenPipeStream | ( | const char * | command, |
const char * | mode | ||
) |
Definition at line 2708 of file fd.c.
References allocatedDescs, AllocateDescPipe, AllocateDesc::create_subid, AllocateDesc::desc, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, fflush(), AllocateDesc::file, GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, mode, numAllocatedDescs, pqsignal(), ReleaseLruFile(), ReleaseLruFiles(), reserveAllocatedDesc(), SIG_DFL, SIG_IGN, and SIGPIPE.
Referenced by BeginCopyFrom(), BeginCopyTo(), pg_import_system_collations(), run_ssl_passphrase_command(), and shell_run_command().
Definition at line 1723 of file fd.c.
References Assert, CurrentResourceOwner, 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 1803 of file fd.c.
References elog, ERROR, MakePGDirectory(), MAXPGPATH, MyProcPid, PathNameOpenFile(), PG_BINARY, PG_TEMP_FILE_PREFIX, snprintf, tempFileCounter, and TempTablespacePath().
Referenced by OpenTemporaryFile().
int OpenTransientFile | ( | const char * | fileName, |
int | fileFlags | ||
) |
Definition at line 2655 of file fd.c.
References OpenTransientFilePerm(), and pg_file_create_mode.
Referenced by ApplyLogicalMappingFile(), CheckPointLogicalRewriteHeap(), CheckPointReplicationOrigin(), 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().
int OpenTransientFilePerm | ( | const char * | fileName, |
int | fileFlags, | ||
mode_t | fileMode | ||
) |
Definition at line 2664 of file fd.c.
References allocatedDescs, AllocateDescRawFD, BasicOpenFilePerm(), AllocateDesc::create_subid, AllocateDesc::desc, DO_DB, elog, ereport, errcode(), errmsg(), ERROR, AllocateDesc::fd, fd(), GetCurrentSubTransactionId(), AllocateDesc::kind, LOG, maxAllocatedDescs, numAllocatedDescs, ReleaseLruFiles(), and reserveAllocatedDesc().
Referenced by be_lo_export(), and OpenTransientFile().
void PathNameCreateTemporaryDir | ( | const char * | basedir, |
const char * | directory | ||
) |
Definition at line 1659 of file fd.c.
References basedir, directory, ereport, errcode_for_file_access(), errmsg(), ERROR, and MakePGDirectory().
Referenced by FileSetCreate().
Definition at line 1860 of file fd.c.
References Assert, CurrentResourceOwner, ereport, errcode_for_file_access(), errmsg(), ERROR, FD_TEMP_FILE_LIMIT, vfd::fdstate, PathNameOpenFile(), PG_BINARY, RegisterTemporaryFile(), ResourceOwnerEnlarge(), and VfdCache.
Referenced by FileSetCreate().
void PathNameDeleteTemporaryDir | ( | const char * | dirname | ) |
Definition at line 1690 of file fd.c.
References LOG, stat, unlink_if_exists_fname(), and walkdir().
Referenced by FileSetDeleteAll().
Definition at line 1931 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), ERROR, LOG, ReportTemporaryFileUsage(), stat::st_size, and stat.
Referenced by FileSetDelete(), and unlink_if_exists_fname().
File PathNameOpenFile | ( | const char * | fileName, |
int | fileFlags | ||
) |
Definition at line 1574 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().
File PathNameOpenFilePerm | ( | const char * | fileName, |
int | fileFlags, | ||
mode_t | fileMode | ||
) |
Definition at line 1587 of file fd.c.
References AllocateVfd(), BasicOpenFilePerm(), DO_DB, elog, ereport, errcode(), errmsg(), ERROR, vfd::fd, vfd::fdstate, vfd::fileFlags, vfd::fileMode, vfd::fileName, vfd::fileSize, free, FreeVfd(), Insert(), LOG, nfile, O_CLOEXEC, ReleaseLruFiles(), vfd::resowner, and VfdCache.
Referenced by PathNameOpenFile().
File PathNameOpenTemporaryFile | ( | const char * | path, |
int | mode | ||
) |
Definition at line 1900 of file fd.c.
References Assert, CurrentResourceOwner, ereport, errcode_for_file_access(), errmsg(), ERROR, mode, PathNameOpenFile(), PG_BINARY, RegisterTemporaryFile(), and ResourceOwnerEnlarge().
Referenced by FileSetOpen().
int pg_fdatasync | ( | int | fd | ) |
Definition at line 479 of file fd.c.
References EINTR, enableFsync, fd(), and fdatasync().
Referenced by issue_xlog_fsync().
bool pg_file_exists | ( | const char * | name | ) |
Definition at line 502 of file fd.c.
References Assert, ereport, errcode_for_file_access(), errmsg(), ERROR, name, S_ISDIR, stat::st_mode, and stat.
Referenced by expand_dynamic_library_name(), find_in_dynamic_libpath(), and provider_init().
void pg_flush_data | ( | int | fd, |
off_t | offset, | ||
off_t | nbytes | ||
) |
Definition at line 524 of file fd.c.
References data_sync_elevel(), EINTR, enableFsync, ereport, errcode_for_file_access(), errmsg(), FATAL, fd(), MAP_FAILED, and WARNING.
Referenced by copy_file(), and FileWriteback().
int pg_fsync | ( | int | fd | ) |
Definition at line 385 of file fd.c.
References Assert, 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().
int pg_fsync_no_writethrough | ( | int | fd | ) |
Definition at line 440 of file fd.c.
References EINTR, enableFsync, fd(), and fsync.
Referenced by issue_xlog_fsync(), and pg_fsync().
int pg_fsync_writethrough | ( | int | fd | ) |
Definition at line 460 of file fd.c.
References enableFsync, and fd().
Referenced by issue_xlog_fsync(), pg_fsync(), and test_sync().
|
static |
Definition at line 702 of file fd.c.
References EINTR, fd(), and ftruncate.
Referenced by FileTruncate(), and pg_truncate().
int pg_truncate | ( | const char * | path, |
off_t | length | ||
) |
Definition at line 719 of file fd.c.
References CloseTransientFile(), EINTR, fd(), OpenTransientFile(), PG_BINARY, and pg_ftruncate().
Referenced by do_truncate().
Definition at line 2931 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 2946 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), and readdir().
Referenced by DeleteAllExportedSnapshotFiles(), ReadDir(), RelationCacheInitFileRemove(), RelationCacheInitFileRemoveInDir(), RemovePgTempFiles(), RemovePgTempFilesInDir(), RemovePgTempRelationFiles(), RemovePgTempRelationFilesInDbspace(), ReorderBufferCleanupSerializedTXNs(), scan_directory_ci(), SyncDataDirectory(), and walkdir().
|
static |
Definition at line 1546 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().
void ReleaseExternalFD | ( | void | ) |
Definition at line 1238 of file fd.c.
References Assert, and numExternalFDs.
Referenced by ClosePostmasterPorts(), CreateWaitEventSet(), dsm_impl_posix(), FreeWaitEventSet(), FreeWaitEventSetAfterFork(), InitializeLatchSupport(), libpqsrv_connect_internal(), libpqsrv_disconnect(), and XLogFileClose().
|
static |
Definition at line 1381 of file fd.c.
References Assert, DO_DB, elog, LOG, LruDelete(), nfile, and VfdCache.
Referenced by AllocateDir(), AllocateFile(), BasicOpenFilePerm(), OpenPipeStream(), and ReleaseLruFiles().
|
static |
Definition at line 1403 of file fd.c.
References max_safe_fds, nfile, numAllocatedDescs, numExternalFDs, and ReleaseLruFile().
Referenced by AllocateDir(), AllocateFile(), LruInsert(), OpenPipeStream(), OpenTransientFilePerm(), PathNameOpenFilePerm(), and ReserveExternalFD().
void RemovePgTempFiles | ( | void | ) |
Definition at line 3296 of file fd.c.
References AllocateDir(), dirent::d_name, 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 3356 of file fd.c.
References AllocateDir(), dirent::d_name, ereport, errcode_for_file_access(), errmsg(), FreeDir(), get_dirent_type(), LOG, MAXPGPATH, PG_TEMP_FILE_PREFIX, PGFILETYPE_DIR, PGFILETYPE_ERROR, ReadDirExtended(), snprintf, and type.
Referenced by PostmasterMain(), and RemovePgTempFiles().
|
static |
Definition at line 3416 of file fd.c.
References AllocateDir(), dirent::d_name, FreeDir(), LOG, MAXPGPATH, ReadDirExtended(), RemovePgTempRelationFilesInDbspace(), and snprintf.
Referenced by RemovePgTempFiles().
|
static |
Definition at line 3444 of file fd.c.
References AllocateDir(), dirent::d_name, ereport, errcode_for_file_access(), errmsg(), FreeDir(), LOG, looks_like_temp_rel_name(), MAXPGPATH, ReadDirExtended(), and snprintf.
Referenced by RemovePgTempRelationFiles().
|
static |
Definition at line 1527 of file fd.c.
References ereport, errmsg(), LOG, log_temp_files, pgstat_report_tempfile(), and size.
Referenced by FileClose(), and PathNameDeleteTemporaryFile().
|
static |
Definition at line 2530 of file fd.c.
References allocatedDescs, ereport, errcode(), errmsg(), ERROR, FD_MINFREE, malloc, max_safe_fds, maxAllocatedDescs, numAllocatedDescs, and realloc.
Referenced by AllocateDir(), AllocateFile(), OpenPipeStream(), and OpenTransientFilePerm().
void ReserveExternalFD | ( | void | ) |
Definition at line 1220 of file fd.c.
References numExternalFDs, and ReleaseLruFiles().
Referenced by AcquireExternalFD(), BackendInitialize(), dsm_impl_posix(), InitializeLatchSupport(), InitPostmasterDeathWatchHandle(), and XLogWrite().
|
inlinestatic |
Definition at line 376 of file fd.c.
References file_resowner_desc, Int32GetDatum(), and ResourceOwnerForget().
Referenced by FileClose().
|
inlinestatic |
Definition at line 371 of file fd.c.
References file_resowner_desc, Int32GetDatum(), and ResourceOwnerRemember().
Referenced by RegisterTemporaryFile().
|
static |
|
static |
Definition at line 4060 of file fd.c.
References Assert, DatumGetInt32(), FileClose(), FileIsValid, res, vfd::resowner, and VfdCache.
void set_max_safe_fds | ( | void | ) |
Definition at line 1043 of file fd.c.
References count_usable_fds(), DEBUG2, elog, ereport, errcode(), errdetail(), errmsg(), FATAL, FD_MINFREE, max_files_per_process, max_safe_fds, Min, and NUM_RESERVED_FDS.
Referenced by PostmasterMain().
void SetTempTablespaces | ( | Oid * | tableSpaces, |
int | numSpaces | ||
) |
Definition at line 3071 of file fd.c.
References Assert, nextTempTableSpace, numTempTableSpaces, pg_global_prng_state, pg_prng_uint64_range(), and tempTableSpaces.
Referenced by assign_temp_tablespaces(), and PrepareTempTablespaces().
void SyncDataDirectory | ( | void | ) |
Definition at line 3567 of file fd.c.
References AllocateDir(), begin_startup_progress_phase(), dirent::d_name, DATA_DIR_SYNC_METHOD_SYNCFS, datadir_fsync_fname(), DEBUG1, enableFsync, ereport, errcode_for_file_access(), errmsg(), FreeDir(), LOG, lstat, MAXPGPATH, PG_TBLSPC_DIR, ReadDirExtended(), recovery_init_sync_method, S_ISLNK, snprintf, stat::st_mode, and walkdir().
Referenced by StartupXLOG().
void TempTablespacePath | ( | char * | path, |
Oid | tablespace | ||
) |
Definition at line 1778 of file fd.c.
References InvalidOid, MAXPGPATH, PG_TBLSPC_DIR, PG_TEMP_FILES_DIR, snprintf, tablespace, and TABLESPACE_VERSION_DIRECTORY.
Referenced by FileSetCreate(), FileSetPath(), OpenTemporaryFileInTablespace(), and pg_ls_tmpdir().
bool TempTablespacesAreSet | ( | void | ) |
Definition at line 3100 of file fd.c.
References numTempTableSpaces.
Referenced by GetTempTablespaces(), and PrepareTempTablespaces().
|
static |
Definition at line 3795 of file fd.c.
References ereport, errcode_for_file_access(), errmsg(), and PathNameDeleteTemporaryFile().
Referenced by PathNameDeleteTemporaryDir().
|
static |
Definition at line 3681 of file fd.c.
References generate_unaccent_rules::action, AllocateDir(), CHECK_FOR_INTERRUPTS, dirent::d_name, FreeDir(), get_dirent_type(), MAXPGPATH, PGFILETYPE_DIR, PGFILETYPE_REG, ReadDirExtended(), snprintf, and subpath().
Referenced by PathNameDeleteTemporaryDir(), and SyncDataDirectory().
|
static |
Definition at line 268 of file fd.c.
Referenced by AllocateDir(), AllocateFile(), AtEOSubXact_Files(), CleanupTempFiles(), ClosePipeStream(), CloseTransientFile(), FreeDesc(), FreeDir(), FreeFile(), OpenPipeStream(), OpenTransientFilePerm(), and reserveAllocatedDesc().
Definition at line 161 of file fd.c.
Referenced by data_sync_elevel().
|
static |
Definition at line 360 of file fd.c.
Referenced by ResourceOwnerForgetFile(), and ResourceOwnerRememberFile().
Definition at line 227 of file fd.c.
Referenced by CleanupTempFiles(), and RegisterTemporaryFile().
int io_direct_flags |
Definition at line 167 of file fd.c.
Referenced by _mdfd_open_flags(), assign_debug_io_direct(), get_sync_bit(), mdprefetch(), mdwriteback(), PrefetchLocalBuffer(), PrefetchSharedBuffer(), read_stream_begin_impl(), ScheduleBufferTagForWriteback(), XLogFileClose(), XLogFileInitInternal(), and XLogPrefetcherNextBlock().
int max_files_per_process = 1000 |
Definition at line 145 of file fd.c.
Referenced by set_max_safe_fds().
int max_safe_fds = FD_MINFREE |
Definition at line 158 of file fd.c.
Referenced by AcquireExternalFD(), ReleaseLruFiles(), reserveAllocatedDesc(), and set_max_safe_fds().
|
static |
Definition at line 267 of file fd.c.
Referenced by AllocateDir(), AllocateFile(), OpenPipeStream(), OpenTransientFilePerm(), and reserveAllocatedDesc().
|
static |
Definition at line 289 of file fd.c.
Referenced by GetNextTempTableSpace(), and SetTempTablespaces().
|
static |
Definition at line 221 of file fd.c.
Referenced by FileClose(), LruDelete(), LruInsert(), PathNameOpenFilePerm(), ReleaseLruFile(), and ReleaseLruFiles().
|
static |
Definition at line 266 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 273 of file fd.c.
Referenced by AcquireExternalFD(), ReleaseExternalFD(), ReleaseLruFiles(), and ReserveExternalFD().
|
static |
Definition at line 288 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 164 of file fd.c.
Referenced by SyncDataDirectory().
|
static |
Definition at line 216 of file fd.c.
Referenced by AllocateVfd(), CleanupTempFiles(), closeAllVfds(), InitFileAccess(), and InitTemporaryFileAccess().
|
static |
Definition at line 279 of file fd.c.
Referenced by OpenTemporaryFileInTablespace().
|
static |
Definition at line 235 of file fd.c.
Referenced by FileClose(), FileTruncate(), and FileWriteV().
|
static |
Definition at line 287 of file fd.c.
Referenced by AtEOXact_Files(), GetNextTempTableSpace(), GetTempTablespaces(), and SetTempTablespaces().
|
static |
Definition at line 215 of file fd.c.
Referenced by AllocateVfd(), CleanupTempFiles(), Delete(), FileAccess(), FileClose(), FileFallocate(), FileGetRawDesc(), FileGetRawFlags(), FileGetRawMode(), FilePathName(), FilePrefetch(), FileReadV(), FileSize(), FileSync(), FileTruncate(), FileWriteback(), FileWriteV(), FileZero(), FreeVfd(), InitFileAccess(), Insert(), LruDelete(), LruInsert(), OpenTemporaryFile(), PathNameCreateTemporaryFile(), PathNameOpenFilePerm(), RegisterTemporaryFile(), ReleaseLruFile(), and ResOwnerReleaseFile().