O_DIRECT. Note that ZFS on Solaris doesn't support direct io.
On Windows the synchronous ioengines don't support direct io.
+atomic=bool If value is true, attempt to use atomic direct IO. Atomic
+ writes are guaranteed to be stable once acknowledged by
+ the operating system. Only Linux supports O_ATOMIC right
+ now.
+
buffered=bool If value is true, use buffered io. This is the opposite
of the 'direct' option. Defaults to true.
* overflow later. this adjustment may be too much if we get
* lucky and the allocator gives us an aligned address.
*/
- if (td->o.odirect || td->o.mem_align || (td->io_ops->flags & FIO_RAWIO))
+ if (td->o.odirect || td->o.mem_align || td->o.oatomic ||
+ (td->io_ops->flags & FIO_RAWIO))
td->orig_buffer_size += page_mask + td->o.mem_align;
if (td->o.mem_type == MEM_SHMHUGE || td->o.mem_type == MEM_MMAPHUGE) {
if (data_xfer && allocate_io_mem(td))
return 1;
- if (td->o.odirect || td->o.mem_align ||
+ if (td->o.odirect || td->o.mem_align || td->o.oatomic ||
(td->io_ops->flags & FIO_RAWIO))
p = PAGE_ALIGN(td->orig_buffer) + td->o.mem_align;
else
o->open_files = le32_to_cpu(top->open_files);
o->file_lock_mode = le32_to_cpu(top->file_lock_mode);
o->odirect = le32_to_cpu(top->odirect);
+ o->oatomic = le32_to_cpu(top->oatomic);
o->invalidate_cache = le32_to_cpu(top->invalidate_cache);
o->create_serialize = le32_to_cpu(top->create_serialize);
o->create_fsync = le32_to_cpu(top->create_fsync);
top->open_files = cpu_to_le32(o->open_files);
top->file_lock_mode = cpu_to_le32(o->file_lock_mode);
top->odirect = cpu_to_le32(o->odirect);
+ top->oatomic = cpu_to_le32(o->oatomic);
top->invalidate_cache = cpu_to_le32(o->invalidate_cache);
top->create_serialize = cpu_to_le32(o->create_serialize);
top->create_fsync = cpu_to_le32(o->create_fsync);
goto skip_flags;
if (td->o.odirect)
flags |= OS_O_DIRECT;
+ if (td->o.oatomic) {
+ if (!FIO_O_ATOMIC) {
+ td_verror(td, EINVAL, "OS does not support atomic IO");
+ return 1;
+ }
+ flags |= OS_O_DIRECT | FIO_O_ATOMIC;
+ }
if (td->o.sync_io)
flags |= O_SYNC;
if (td->o.create_on_open)
.BI direct \fR=\fPbool
If true, use non-buffered I/O (usually O_DIRECT). Default: false.
.TP
+.BI atomic \fR=\fPbool
+If value is true, attempt to use atomic direct IO. Atomic writes are guaranteed
+to be stable once acknowledged by the operating system. Only Linux supports
+O_ATOMIC right now.
+.TP
.BI buffered \fR=\fPbool
If true, use buffered I/O. This is the opposite of the \fBdirect\fR parameter.
Default: true.
ret = 1;
}
+ /*
+ * O_ATOMIC implies O_DIRECT
+ */
+ if (td->o.oatomic)
+ td->o.odirect = 1;
+
return ret;
}
total_mem = td->orig_buffer_size;
- if (td->o.odirect || td->o.mem_align ||
+ if (td->o.odirect || td->o.mem_align || td->o.oatomic ||
(td->io_ops->flags & FIO_MEMALIGN)) {
total_mem += page_mask;
if (td->o.mem_align && td->o.mem_align > page_size)
unsigned int total_mem;
total_mem = td->orig_buffer_size;
- if (td->o.odirect)
+ if (td->o.odirect || td->o.oatomic)
total_mem += page_mask;
if (td->o.mem_type == MEM_MALLOC)
.category = FIO_OPT_C_IO,
.group = FIO_OPT_G_IO_TYPE,
},
+ {
+ .name = "atomic",
+ .lname = "Atomic I/O",
+ .type = FIO_OPT_BOOL,
+ .off1 = td_var_offset(oatomic),
+ .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
+ .def = "0",
+ .category = FIO_OPT_C_IO,
+ .group = FIO_OPT_G_IO_TYPE,
+ },
{
.name = "buffered",
.lname = "Buffered I/O",
#define FIO_O_NOATIME 0
#endif
+#ifdef O_ATOMIC
+#define OS_O_ATOMIC O_ATOMIC
+#else
+#define OS_O_ATOMIC 040000000
+#endif
+
#ifdef MADV_REMOVE
#define FIO_MADV_FREE MADV_REMOVE
#endif
#define OS_O_DIRECT O_DIRECT
#endif
+#ifdef OS_O_ATOMIC
+#define FIO_O_ATOMIC OS_O_ATOMIC
+#else
+#define FIO_O_ATOMIC 0
+#endif
+
#ifndef FIO_HAVE_HUGETLB
#define SHM_HUGETLB 0
#define MAP_HUGETLB 0
};
enum {
- FIO_SERVER_VER = 26,
+ FIO_SERVER_VER = 27,
FIO_SERVER_MAX_FRAGMENT_PDU = 1024,
enum file_lock_mode file_lock_mode;
unsigned int odirect;
+ unsigned int oatomic;
unsigned int invalidate_cache;
unsigned int create_serialize;
unsigned int create_fsync;
uint32_t file_lock_mode;
uint32_t odirect;
+ uint32_t oatomic;
uint32_t invalidate_cache;
uint32_t create_serialize;
uint32_t create_fsync;