Some operating systems don't perform a data integrity flush when
fsync() is done, but provide fcntl(fd, F_FULLSYNC) to provide that kind
of guarantee.
To ensure that comparisons between operating systems is fair, use
fcntl() to do a proper sync if available.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fi
print_config "zlib" "$zlib"
fi
print_config "zlib" "$zlib"
+##########################################
+# fcntl(F_FULLFSYNC) support
+if test "$fcntl_sync" != "yes" ; then
+ fcntl_sync="no"
+fi
+cat > $TMPC << EOF
+#include <unistd.h>
+#include <fcntl.h>
+
+int main(int argc, char **argv)
+{
+ return fcntl(0, F_FULLSYNC);
+}
+EOF
+if compile_prog "" "" "fcntl(F_FULLSYNC)" ; then
+ fcntl_sync="yes"
+fi
+print_config "fcntl(F_FULLSYNC)" "$fcntl_sync"
+
##########################################
# linux-aio probe
if test "$libaio" != "yes" ; then
##########################################
# linux-aio probe
if test "$libaio" != "yes" ; then
if test "$pdb" = yes; then
output_sym "CONFIG_PDB"
fi
if test "$pdb" = yes; then
output_sym "CONFIG_PDB"
fi
+if test "$fcntl_sync" = "yes" ; then
+ output_sym "CONFIG_FCNTL_SYNC"
+fi
print_config "Lib-based ioengines dynamic" "$dynamic_engines"
cat > $TMPC << EOF
print_config "Lib-based ioengines dynamic" "$dynamic_engines"
cat > $TMPC << EOF
int ret;
if (io_u->ddir == DDIR_SYNC) {
int ret;
if (io_u->ddir == DDIR_SYNC) {
+#ifdef CONFIG_FCNTL_SYNC
+ ret = fcntl(io_u->file->fd, F_FULLSYNC);
+#else
ret = fsync(io_u->file->fd);
ret = fsync(io_u->file->fd);
} else if (io_u->ddir == DDIR_DATASYNC) {
#ifdef CONFIG_FDATASYNC
ret = fdatasync(io_u->file->fd);
} else if (io_u->ddir == DDIR_DATASYNC) {
#ifdef CONFIG_FDATASYNC
ret = fdatasync(io_u->file->fd);