Block I/O scheduler with sorting and power failure

60 views Asked by At

While reading about I/O schedulers (CFQ, noop, deadline) I found that some of them (for example deadline) sorts blocks before writing.

Could anybody give a hint how file system survives power failures when blocks are sorted before writing? Let's say journal has to go before writing data on file system level, then i/o scheduler reordered blocks and in the middle of writing this batch to a block device we have a power failure?

1

There are 1 answers

0
Sankalp Bose On

An I/O barrier is issued just after the journal block write requests, to ensure ordering between the journal and final write. The barrier operation is respected by all layers in the storage system, for example it ensures cache flush at the Disk or switch etc.