Skip to contentSkip to conversation

write / fsync ordering

DISCUSSION Vitaliy Filippov 2 participants 3 messages Jan 28, 2020 io_uring

lore
Share & tools
lore
#0 lore raw

Hi everyone,

Can someone point out if io_uring may reorder write and fsync requests?

If I submit a write request and an fsync request at the same time, does that mean that fsync will sync that write request, or does it only sync completed requests?

Signature · 2 lines
With best regards,
  Vitaliy Filippov
#1 lore raw
Quoted 7 lines · Vitaliy Filippov

Hi everyone,

Can someone point out if io_uring may reorder write and fsync requests?

If I submit a write request and an fsync request at the same time, does that mean that fsync will sync that write request, or does it only sync completed requests?

Yes, it can reorder them. So, there are 2 ways:
- wait for the completion
- order the requests within io_uring

I'd recommend the ordering option by using IOSQE_IO_LINK, which guarantees sequential execution of linked requests. There is also IOSQE_IO_DRAIN, but it's rather inefficient.

Signature · 1 line
Pavel Begunkov
#2 lore raw

Thanks, I'll try it :)

Quoted 7 lines

Yes, it can reorder them. So, there are 2 ways:
- wait for the completion
- order the requests within io_uring

I'd recommend the ordering option by using IOSQE_IO_LINK, which guarantees sequential execution of linked requests. There is also IOSQE_IO_DRAIN, but it's rather inefficient.

Signature · 2 lines
With best regards,
  Vitaliy Filippov