Re: [PATCH 01/21] block: Add atomic write operations to request_queue limits
From: John Garry
Date: Thu Oct 05 2023 - 10:49:09 EST
On 04/10/2023 22:00, Bart Van Assche wrote:
We only care about *PF. The *N variants were cut from the same cloth as
TRIM and UNMAP.
Hi Martin,
Has the following approach been considered? RWF_ATOMIC only guarantees
atomicity. Persistence is not guaranteed without fsync() / fdatasync().
This is the approach taken. Please consult the proposed man pages, where
we say that persistence is not guaranteed without
O_SYNC/O_DSYNC/fsync()/fdatasync()
The only thing which RWF_ATOMIC guarantees is that the write will not be
torn.
If you see 2.1.4.2.2 Non-volatile requirements in the NVMe spec, it
implies that the FUA bit or a flush command is required for persistence.
In 4.29.2 Atomic write operations that do not complete in SBC-4, we are
told that atomic writes may pend in the device volatile cache and no
atomic write data will be written if a power failure causes loss of data
from the write.
I think this would be more friendly towards battery-powered devices
(smartphones). On these devices it can be safe to skip fsync() /
fdatasync() if the battery level is high enough.
Thanks,
John