Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
if (f->file_map)
memset(f->file_map, 0, f->num_maps * sizeof(int));
+#ifdef FIO_OS_DIRECTIO
+ /*
+ * Some OS's have a distinct call to mark the file non-buffered,
+ * instead of using O_DIRECT (Solaris)
+ */
+ if (td->o.odirect) {
+ int ret = fio_set_odirect(f->fd);
+
+ if (ret) {
+ td_verror(td, ret, "fio_set_odirect");
+ goto err;
+ }
+ }
+#endif
+
done:
log_file(td, f, FIO_LOG_OPEN_FILE);
return 0;
#ifndef FIO_OS_SOLARIS_H
#define FIO_OS_SOLARIS_H
+#include <sys/types.h>
+#include <sys/fcntl.h>
+
#define FIO_HAVE_POSIXAIO
#define FIO_HAVE_SOLARISAIO
#define FIO_HAVE_FALLOCATE
return val;
}
+#define FIO_OS_DIRECTIO
+extern int directio(int, int);
+static inline int fio_set_odirect(int fd)
+{
+ if (directio(fd, DIRECTIO_ON) < 0)
+ return errno;
+
+ return 0;
+}
+
#endif