I know that when I write files using write() + fsync() (or O_SYNC + write(), I think they are same ref #1 ref #2), it means I am using blocking synchronous I/O, and the if the write()(with O_SYNC) or fsync() returns, it means the data is safely on the device medium (e.g., TLC NAND for SSD) rather than the device cache (e.g., DDRAM in SSD).
While what if I use libaio? (because I want to make sure the write issued by libaio is on the storage medium rather than the device cache. i.e., I suppose when io_getevents() returns, it may not make sure the write is on the storage medium, and it may just on the device cache)
- Question 1: does fsync()exclusively works for synchronous I/O?
- Question 2:is fsync()afterio_submit()an undefined behavior?
- Question 3: how to make asynchronous write safely persisted to the device medium rather than device cache (no battery-backed cache).
 
    