3 ms·
The trick is not allowing such a thing. Don't have something vague like "fsync_that_works" that could be implemented arbitrarily. Have a function that is docum
by dale_glass 3y ago
The trick is not allowing such a thing. Don't have something vague like "fsync_that_works" that could be implemented arbitrarily.
Have a function that is documented to implement a highly specific contract, like "writes all pending blocks of this file to disk, and ensures they'll be there if there's a crash after the function returns".
- fl0ki 3y agoThat's exactly what people expect from fsync(). The problem explained in the article is that, due to the difficulties of tracing every possible related write, it is (was?) often implemented conservatively and waited for more writes to land than were strictly necessary. I don't know how much this tracing has improved in various kernels since 2009, but I do know that I would want them to benefit fsync(), not to make a new function with a subtly different contract.