fsync directory on file creation if sync_dirs set
[tridge/dbench.git] / fileio.c
index 9b3159edfb2a4710e9922cef524beb268ae7120e..f3ed779214789d43ce339cc4a9ce265ea5269894 100644 (file)
--- a/fileio.c
+++ b/fileio.c
@@ -310,6 +310,9 @@ static void fio_createx(struct dbench_op *op)
 
        fstat(fd, &st);
 
+       if (options.sync_dirs && (flags & O_CREAT)) 
+               fsync(fd);
+
        if (!S_ISDIR(st.st_mode)) {
                xattr_fd_write_hook(op->child, fd);
        }