Ordered Mode vs Writeback Mode

6k views Asked by At

In Writeback mode, only inode data is written to the journal and there is no control over when the file data is written.

This line made me think when the data would be written to a device in the normal case and when data would be lost.

Is there, in Writeback mode, any option to write data forcefully to a device immediately after the journaling so it would guaranty the same safety as offered by the Ordered mode?

Also, are the Writeback mode and Ordered mode differentiated based only on this?

1

There are 1 answers

1
BIBS On

If we don't go much in detail , then the answer to the query is yes (at least in filesystem like ext3).In both the modes only filesystem metadata is written into the journal. The difference between writeback mode and ordered mode is that in Ordered mode filesystem groups metadata and relative data blocks so that data blocks are written to disk before the metadata is logged while in ordered only metadata is logged (& data blocks are not written into disk at all).

ii. From the implementation perspective(in terms of ext3), in ordered mode an additional function journal_dirty_data( ) is invoked on every buffer of data in the page to insert the buffer in a proper list of the active transactions. The JBD layer ensures that all buffers in this list are written to disk before the metadata buffers of the transaction.After that generic_commit_write( ) function is invoked, which inserts the data buffers in the list of the dirty buffers of the owner inode. In writeback mode , no such function like journal_dirty_data( ) is invoked on data buffers and only generic_commit_write( ) is called.