#include "gstdio.h"
#include "glibintl.h"
+#ifdef HAVE_LINUX_MAGIC_H /* for btrfs check */
+#include <linux/magic.h>
+#include <sys/vfs.h>
+#endif
/**
* g_mkdir_with_parents:
goto out;
}
+
+#ifdef BTRFS_SUPER_MAGIC
+ {
+ struct statfs buf;
+
+ /* On Linux, on btrfs, skip the fsync since rename-over-existing is
+ * guaranteed to be atomic and this is the only case in which we
+ * would fsync() anyway.
+ */
+
+ if (fstatfs (fd, &buf) == 0 && buf.f_type == BTRFS_SUPER_MAGIC)
+ goto no_fsync;
+ }
+#endif
#ifdef HAVE_FSYNC
{
}
}
#endif
+ no_fsync:
errno = 0;
if (fclose (file) == EOF)