diff options
Diffstat (limited to 'src/common/file_utils.c')
-rw-r--r-- | src/common/file_utils.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/file_utils.c b/src/common/file_utils.c index a978e64f5a1..72b0565c710 100644 --- a/src/common/file_utils.c +++ b/src/common/file_utils.c @@ -116,6 +116,25 @@ fsync_pgdata(const char *pg_data, } /* + * Issue fsync recursively on the given directory and all its contents. + * + * This is a convenient wrapper on top of walkdir(). + */ +void +fsync_dir_recurse(const char *dir, const char *progname) +{ + /* + * If possible, hint to the kernel that we're soon going to fsync the data + * directory and its contents. + */ +#ifdef PG_FLUSH_DATA_WORKS + walkdir(dir, pre_sync_fname, false, progname); +#endif + + walkdir(dir, fsync_fname, false, progname); +} + +/* * walkdir: recursively walk a directory, applying the action to each * regular file and directory (including the named directory itself). * |