aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2018-11-07 09:51:50 +1300
committerThomas Munro <tmunro@postgresql.org>2018-11-07 09:51:50 +1300
commitc24dcd0cfd949bdf245814c4c2b3df828ee7db36 (patch)
tree7b361229b1a9bb895894dff9eaa8a593be9e20ce /src/include
parent3fd2a7932ef0708dda57369bb20c0499d905cc82 (diff)
downloadpostgresql-c24dcd0cfd949bdf245814c4c2b3df828ee7db36.tar.gz
postgresql-c24dcd0cfd949bdf245814c4c2b3df828ee7db36.zip
Use pg_pread() and pg_pwrite() for data files and WAL.
Cut down on system calls by doing random I/O using offset-based OS routines where available. Remove the code for tracking the 'virtual' seek position. The only reason left to call FileSeek() was to get the file's size, so provide a new function FileSize() instead. Author: Oskari Saarenmaa, Thomas Munro Reviewed-by: Thomas Munro, Jesper Pedersen, Tom Lane, Alvaro Herrera Discussion: https://postgr.es/m/CAEepm=02rapCpPR3ZGF2vW=SBHSdFYO_bz_f-wwWJonmA3APgw@mail.gmail.com Discussion: https://postgr.es/m/b8748d39-0b19-0514-a1b9-4e5a28e6a208%40gmail.com Discussion: https://postgr.es/m/a86bd200-ebbe-d829-e3ca-0c4474b2fcb7%40ohmu.fi
Diffstat (limited to 'src/include')
-rw-r--r--src/include/storage/fd.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h
index 8e7c9728f4b..1289589a46b 100644
--- a/src/include/storage/fd.h
+++ b/src/include/storage/fd.h
@@ -15,7 +15,7 @@
/*
* calls:
*
- * File {Close, Read, Write, Seek, Tell, Sync}
+ * File {Close, Read, Write, Size, Sync}
* {Path Name Open, Allocate, Free} File
*
* These are NOT JUST RENAMINGS OF THE UNIX ROUTINES.
@@ -42,10 +42,6 @@
#include <dirent.h>
-/*
- * FileSeek uses the standard UNIX lseek(2) flags.
- */
-
typedef int File;
@@ -68,10 +64,10 @@ extern File PathNameOpenFilePerm(const char *fileName, int fileFlags, mode_t fil
extern File OpenTemporaryFile(bool interXact);
extern void FileClose(File file);
extern int FilePrefetch(File file, off_t offset, int amount, uint32 wait_event_info);
-extern int FileRead(File file, char *buffer, int amount, uint32 wait_event_info);
-extern int FileWrite(File file, char *buffer, int amount, uint32 wait_event_info);
+extern int FileRead(File file, char *buffer, int amount, off_t offset, uint32 wait_event_info);
+extern int FileWrite(File file, char *buffer, int amount, off_t offset, uint32 wait_event_info);
extern int FileSync(File file, uint32 wait_event_info);
-extern off_t FileSeek(File file, off_t offset, int whence);
+extern off_t FileSize(File file);
extern int FileTruncate(File file, off_t offset, uint32 wait_event_info);
extern void FileWriteback(File file, off_t offset, off_t nbytes, uint32 wait_event_info);
extern char *FilePathName(File file);