The next step of the mount process is the scan method when JFFS2 reads the contents of the flash, and builds up the memory structures. The fs uses a read buffer (flash_buf
) whereto it loads the content or a part of the content (128k max.) of the eraseblock and scans the loaded data. If the scan process finds a node then does the following (depending on the type of the node):
- JFFS2_NODETYPE_INODE :
allocates jffs2_alloc_raw_node_ref structure for it, sets the appropriate fields and sets it to the last node of the jeb (next_phys list) and adds it to the next_in_ino list of the inodecache of inode.
If the ic (inode cache) of the inode doesn't exist then it allocates a new jffs2_alloc_inode_cache structure and fills it and adds it to the inodecache_list.
- JFFS2_NODETYPE_DIRENT :
allocates jffs2_alloc_full_dirent structure for it and sets the appropriate fields, allocate memory (pointed by fd->name
) for the name of the dirent and copies the name into the structure.
After this allocates jffs2_alloc_raw_node_ref structure for the dirent, sets the appropriate fields and sets it to the last node of the jeb (next_phys list) and adds it to the next_in_ino list of the inodecache of inode. If the ic (inode cache) of the inode doesn't exist then it allocates a new jffs2_alloc_inode_cache structure and fills it and adds it to the inodecache_list. Finally the jffs2_alloc_full_dirent structure is added to the scan_dents list of the inodecache of inode.
- JFFS2_NODETYPE_CLEANMARKER :
if it is the first cleanmarker in the jeb and the size of node is equal to the size of the cleanmarker of the filesystem then it allocates jffs2_alloc_raw_node_ref structure for it, sets the appropriate fields and sets it to the first node of the jeb (jeb->first_node
).
- JFFS2_NODETYPE_PADDING :
the filesystem doesn't allocate any memory for it and the length of the node is marked as wasted.
Havasi Ferenc
2005-12-22