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/cconv.c b/cconv.c
index 21e3a51..82383b2 100644
--- a/cconv.c
+++ b/cconv.c
@@ -89,6 +89,7 @@
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);
@@ -252,6 +253,7 @@
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);