I'm writing my own data store directly on top of a block device. To ensure durability I want to sync to disk. But here's the thing: I want to sync only part of it.
I'm keeping a journal for crash recovery, and write my future changes to the journal before applying them to the actual place on disk. Then I want to ensure the journal changes are written to disk, and only then make the actual changes to the rest of the disk (which I don't care about fsyncing, until I checkpoint my journal).
I could simply fsync the entire block device, but that forces a lot of things that aren't urgent to be written out.
I have thought of two options, but I'm surprised there is no partial fsync(2) call and nobody asking for it from what I've found.