Async I/O
Posted Apr 8, 2009 4:19 UTC (Wed) by
jamesh (guest, #1159)
In reply to:
Async I/O by bojan
Parent article:
Linux Storage and Filesystem workshop, day 1
Your aio_fsync() suggestion would give a significantly different result to fbarrier().
Consider a function that wrote a file and renamed it using the hypothetical fbarrier():
fp = open("filename.tmp")
write(fp, "data", length)
fbarrier(fp)
close(fp)
rename("filename.tmp", "filename")
When this function completes, any process reading the file will get the new contents. The changes to the underlying block device could be delayed, but if there is a crash "filename" should either give the old contents or the new.
Using aio_fsync() as you suggest would keep the same crash resilience behaviour, but would provide entirely different runtime behaviour. As the signal would likely be delivered after the function returns, the rename won't have happened at that point. So a read of "filename" will return the old file contents for some unknown period of time after the function returns.
(
Log in to post comments)