atomic file operations
estelle.hammache at st.com
Thu Mar 24 06:59:19 EST 2005
"Artem B. Bityuckiy" wrote:
> Estelle HAMMACHE wrote:
> > Yes, when I write that the input buffer is split it means that
> > several data nodes are written to the flash - each data node
> > is an independent piece of data complete with header and CRC.
> > If a data node is only partly written to flash, its CRC check
> > will fail so the partial data will not be taken into account
> > when building the file at next mount. In this sense each data
> > node is an atomic write - but JFFS2 does not guarantee that
> > a write() input buffer will be written as a single data node.
> But if you:
> 1. write only 0-PAGE_SIZE bytes;
> 2. do not overlap n*PAGE_SIZE borders (n is 1,2, ...)
> 3. do fsync after write.
> then you have the guarantee that you either have written all or
> nowthing. JFFS2 does guarantee that due to its implementation.
This is not what I understand from jffs2_write_inode_range.
When you reach the end of the block your data may be split at
any offset because jffs2_reserve_space may return more than
JFFS2_MIN_DATA_LEN but less than the data size (or not enough
space to compress the whole input buffer if you use compression).
Or is there some trick here that I don't understand ??
More information about the linux-mtd