atomic file operations

Artem B. Bityuckiy dedekind at infradead.org
Thu Mar 24 14:32:51 EST 2005


> Artem, when figuring out if the write goes over the page boudary you did 
not say
> anything about CRC and other non-user data.. Should it be taken into 
account
> too or am I missing something?
>

Well, page boundaries aren't problem. We want a write operation which goes 
to flash a one node.

There are two points of splitting:
1. Linux page cache splits data on PAGE_SIZE chunks.
2. jffs2_write_inode_range may do further split. This is what I missed 
first time.

Yes, jffs2_write_inode_range will not split if the node to write is fewer 
then sizeof(struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN.

So, sizeof(struct jffs2_raw_inode) includes all the "anything about CRC 
and other non-user data" and you may write JFFS2_MIN_DATA_LEN bytes 
atomically.

So, I'll write the rules again:
1. write only 0- JFFS2_MIN_DATA_LEN bytes;
2. do not overlap n*PAGE_SIZE borders (n is 1,2, ...)
3. do fsync after write

--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.




More information about the linux-mtd mailing list