About jffs file system

Source: Internet
Author: User
About jffs file system jffs (thejournallingflashfilesystem), it is called a log file system because when the system changes, it first writes the changes to the log and then checks the log, whether the change is complete. the log writing action is... about jffs file system jffs (the journalling flash file system), it is called a log file system because when the system changes, it first writes the changes to the log, then, check whether the log is completely changed. the log write action is atomic. Unlike modifying the file system, the log write action is performed in multiple steps, which is relatively safer. There is a situation where the file system is very insecure, that is, power-off. for example, when creating a new file, a file icon is created first, and then the space is allocated, if there is a breakpoint in the two steps, the icon is created, but no space is allocated. The system will be disordered. if you use the log function, first write the content of a file created into the log (atomic), and then process the action. It will be much safer. Www.2cto.com 1. flash translation layer because the jffs file system runs on block devices, flash uses block-based erasure units, which requires a layer of conversion, the block-based operation unit is converted to the slice-based operation unit (512 bytes). This layer of conversion maps all the flash files to the memory, during upper-layer operations, the memory is operated based on the size of the slice. after all the operations on a piece of data are completed, the entire data erasure is overwritten to a specific physical block. mtdblock provides this layer of conversion, but there is no rewrite security mechanism or garbage collection mechanism, but if the file system is read-only, this method is better. Www.2cto.com 2. ftl/nftl mtdblock does not solve the balance problem. One way to solve this problem is to record the correspondence between the slice and the erased block, even if the corresponding relationship is changed, when data is written to another erasure, the memory sector will know which flash to read and write. ftl and nftl solve this problem, but ftl and nftl have patent problems, it can only be used by a specific FLASH manufacturer and cannot be used universally. III. garbage collection mechanism because there are jffs_raw_inode nodes in the log, and these nodes correspond to inode in flash. once inode is allocated close to the end of flash, the Garbage collection mechanism will be triggered. it will re-detect from the first node, know that the dirty page is detected, erase, re-allocate space, and add it to the end of the current node linked list. The key to implementing the www.2cto.com jffs file system is the node. in the Mount file system, scan the entire device and create a node. a new action will generate a new node, the jffs file system is slow to mount. this is because a log is required to be created to mount the jffs file system. The log is saved as a jffs_raw_inode node linked list, that is, the node linked list will be generated by traversing the system during mounting, so it will be very slow. The jffs file system uses struct jffs_raw_inode to represent data. when a new data block is added, a struct jffs_raw_inode struct is created. Once a jffs_raw_inode is modified, a node is created, at the same time, write the modified data to the new node, and mark the previous node as dirty.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.