Are there any guarantees as to when and in what order dirty pages are written out to disk? In the specific case of log structured files (files that are only ever appended to), is it possible for dirty pages to accumulate and be written to disk out of order?
For example, imagine a log file with the following dirty pages that have accumulated...
1: file_offset=16kb page_len=4kb <-- dirty 2: file_offset=20kb page_len=4kb <-- dirty 3: file_offset=24kb page_len=4kb <-- dirty
Will Linux write out the above dirty pages in order or is there a chance they they'll get written out of order? If out of order writing is a possibility, how do databases and applications that generate log files handle this? For example, if page 3 gets written out first and the OS crashes before it can write out 1 and 2, there'll be a 8kb filehole.