After the mount process the JFFS2 works in the following mode:
If fs reserves space for a new node then EBS checks if c->nextblock
has enough space for the new node and its summary data. If it does then the fs gets the maximum available space in the current jeb (jeb->free_size
- (collected summary info) - (new node's summary size)). Otherwise EBS generates the summary node and writes it out to the flash. Summary node uses all of the available space in jeb, it means that if the fs writes out summary node then there is no free space behind the summary node in that jeb.
If fs tries to write a new node to flash then EBS collects the necessary information from the node to generate its summary information and adds it to the summary list. The size of the summary info depend on the type of the node. If node type is
- JFFS2_NODETYPE_INODE then it allocates jffs2_sum_inode_mem structure and copies the necessary fields from the inode to the jffs2_sum_inode_mem, adds the structure to the end of the summary list (sum_list_tail) and increases sum_size and sum_num.
- JFFS2_NODETYPE_DIRENT then it allocates jffs2_sum_dirent_mem structure and copies the necessary fields and the name of the dirent from the dirent to the jffs2_sum_dirent_mem, adds the structure to the end of the summary list (sum_list_tail) and increases sum_size and sum_num.
- JFFS2_NODETYPE_CLEANMARKER then it does nothing, because the summary node has a field (cln_mkr) to store the size of the cleanmarker.
- JFFS2_NODETYPE_PADDING then it increases the sum_padded variable by the size of the padding node.
Havasi Ferenc
2005-12-22