Add support for O_ATOMIC
O_ATOMIC makes writes atomic, meaning that they are fully stable
on media (in the event of a power cut) when acknowledged by the
device and OS.
This only truly works on Linux with the pending patches to
add O_ATOMIC.
Updated by Jens to:
- Add man page and HOWTO description of the option
- Make O_ATOMIC imply O_DIRECT, so that it actually works if you
don't set O_DIRECT manually.
- Add the option to the conversion list so it works for
client/server.
- Error handling so that if atomic=1 is set and the OS does not
support it, error out instead of just pretending it works.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/options.c b/options.c
index f26ff77..4b4c251 100644
--- a/options.c
+++ b/options.c
@@ -1893,6 +1893,16 @@
.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",
.type = FIO_OPT_BOOL,