On Thu, Oct 23, 2003 at 01:24:55PM -0500, Vijayan Prabhakaran
wrote:> Ext3 enforces certain ordering in writes to ensure data integrity. For
> example, the journal writes are issued first and only after their
> successful completion the actual writes are issued.
>
> Sometimes we need to maintain ordering across transactions also. This is
> needed because if the actual writes of one transaction and the journal
> writes of another transaction are scheduled differently then data
> integrity may be lost.
Ext3 enforces ordering in writes to ensure filesystem integrity. If
you care about the order in which data blocks are written to files,
you must use fsync(). This is always been the case with Unix
applications, and ext3 is no different here.
The one exception is if you enable data block journaling. In that
case, data blocks are themselves written into the journal, so ordering
is guaranteed. However, you *still* will need to use fsync() to force
the close of a transaction at times which make sense to the article.
Otherwise, you will have a guarantee of write ordering, so that when
writing the blocks b1, b2, b3, b4, and b5, you will know that b3 is
written, b1 and b2 are written, and so on, but there will no guarantee
how far along the sequence of b1..b5 if at all has been written. Ext3
normally coaleses many filesystem operations into a single
transaction.
- Ted