thanks that answered my question. One more question, is it possible to stop the delayed block allocation in ext4 ?|
>>> Andreas Dilger <adilger dilger ca> 6/3/2013 8:17 PM >>>
On 2013-06-02, at 23:33, "Arul Selvan" <Rarul novell com> wrote:
> Greetings. I am Arul Selvan works for Novell. I am exploring the Ext4 architecture, more specifically i would like to understand the write ordering, basically the same blocks is modified more than once, how the write is ordered. Could you point me the doc or the specific source file to look.
Writes in memory to the same file are serialized by i_mutex, but may
modify the same page in memory repeatedly.
When that page us being written to disk, it will be marked with the
page writeback flag, in order to stabilize the content, and allow consistent
checksums (e.g. for MD RAID or disks with T10-DIF). This may block
any further writes from modifying the same page as it is being
submitted to disk, depending on the kernel version and the
requirements of the underlying storage. Once the disk write has been
finished, the writeback bit is cleared and the page can be modified again.
In all cases, the writes to a single page are ordered, but there is no
_guarantee_ about writes to different data blocks being ordered.
The ext4 journal will in fact impose some order on data writes,
by ensuring that the data from all writes associated with a transaction
are flushed before the data for the next transaction.
Since fsync() of any file commits the current transaction, this has
the side-effect that any fsync causes all older writes to be committed. This is NOT required by POSIX, and applications that depend on this behavior are not portable to/safe on other filesystems.