|
|
|
|
|
by n_u
187 days ago
|
|
> Submit the write to the primary file > Link fsync to that write (IOSQE_IO_LINK) > The fsync's completion queue entry only arrives after the
write completes > Repeat for secondary file Wait, so the OS can re-order the fsync() to happen before the write request it is supposed to be syncing? Is there a citation or link to some code for that? It seems too ridiculous to be real. > O_DSYNC: Synchronous writes. Don't return from write() until the data is actually stable on the disk. If you call fsync() this isn't needed correct? And if you use this, then fsync() isn't needed right? |
|
This is an io_uring-specific thing. It doesn't guarantee any ordering between operations submitted at the same time, unless you explicitly ask it to with the `IOSQE_IO_LINK` they mentioned.
Otherwise it's as if you called write() from one thread and fsync() from another, before waiting for the write() call to return. That obviously defeats the point of using fsync() so you wouldn't do that.
> If you call fsync(), [O_DSYNC] isn't needed correct? And if you use [O_DSYNC], then fsync() isn't needed right?
I believe you're right.