Ext3: Why data=journal is better than data=ordered when data needs to be read from and written to disk at the same time

Ted Ts'o tytso at mit.edu
Sun Mar 27 02:44:10 UTC 2011

On Sat, Mar 26, 2011 at 08:25:23PM -0400, Jidong Xiao wrote:
> But my question is, why data=journal could outperform data=ordered,
> for the data=journal mode, you have to write the data and metadata
> blocks into the journal, but for the data=ordered mode, you only have
> to write the metadata blocks into the journal. If, in some certain
> cases, the former mode can avoid seeks, then the same behavior should
> apply to the latter mode. So it's really odd that the former mode can
> outperform the latter mode.

When executing an fsync(), in data=ordered mode you have to write the
data data blocks into the journal and wait for the data blocks to be
written.  This requires generally will require extra seeks.  In
data=journaled mode, the data blocks can be written directly into the
sjoujournal without needing to seek.

Of course eventually the data and metadata blocks will need to be
written to their permanent locations before the journal space can be
reused.  But for short bursty write patterns, the fsync() latency will
be much smaller in data=journal mode.


						- Ted

More information about the Ext3-users mailing list