Ubifs Core objects-TNC and LPT

Source: Internet
Author: User

The central problem with file systems is storage. This implies 2 questions: 1) What is stored? 2) where to store? The various technical means in the file system are how to solve these 2 problems efficiently. UBIFS uses node to standardize each storage object, describe each logical block space with Lprops, manage all node objects with the TNC organization, and manage all Lprops objects with LPT organization. nodeIn addition to storing user data, Ubifs also stores data such as index nodes, catalog items, and super blocks. These data structures vary widely, and in order to unify the data view for ease of management, ubifs standardizes the presentation of all the data, all of which are presented as node representations. node is categorized, stored, and organized according to different uses.          Ubifs's node summary is described below. The black part is common file system data, the red part is ubifs proprietary file system data.

TNCBecause of the large number of Ubifs_ino_node,ubifs_data_node,ubifs_dent_node,ubifs_xent_node,ubifs_trun_node nodes, UBIFS uses B + trees to manage these nodes. The index of each node in the tree is (Inode, Key2), as shown, different node has different key2. The goal is to quickly find the location of the leaf node data based on index, but the number of index nodes in the B + tree is very slow, and if the process is interrupted, the leaf node file is lost. Therefore, before the commit TNC, the data information of the leaf node file is committed to the log area, so that both improve the speed, but also to ensure that the TNC commit failure, the leaf node file can also be found through the log area, and replay to the TNC. Journal ReplayFrom the point of view of data, the process of recovery is the process of converting (LEB, offs) list into processing, mapping to {key: [Leb, Offs, Len]} b+tree. The detailed process for log playback is as follows: Get ref node from the log area ((Leb, offs)), Get Bud location information (leb:offs) from ref node, construct the memory object bud, and filter out the invalid node based on this information in the scan section Leb , add a valid node to Sleb->nodes for later replay, and if it is the last bud and need recovery, leb:0-offs this offsite backup to another PEB. The node on the sleb->nodes is processed into replay_entry and added to the C->replay_list, which is then constructed as Ubifs_zbranch ({key: [Leb, offs, Len) according to the replay_list. ]}) object is updated to the TNC B + Tree, and then the replay buds Leb block of free and dirty space, dirty tag, etc. lprop attribute information SyncIf the data in Sync,buf is not called before unclean reboot is not synchronized to flash, the Ubifs file system may be destroyed.          Sync invokes ubifs_run_commit for all data submissions. If a power outage occurs during the call to sync, the file will be lost if a power outage occurs before or during WBUF commit, which requires the application layer to actively call sync to ensure.          But Wbuf commit quickly, this is a small probability event, if the power outage before log commit, the file will be lost, which requires the application layer to actively call sync to ensure. If a power outage occurs during log commit, the file is still lost. But log commit quickly, this is a small probability event, in other cases, such as before the GC commit, or before the TNC commit or the process of power loss, the file is not lost, because it can be replay from the log area. LpropsUbifs uses the node object to solve the problem of storage objects, and uses the Lprops object to solve the storage location problem.          To determine where new objects are stored, you need to get the entire storage space to use view data to aid decision-making. The Lprops object uses the (lnum,free,dirty) tuple information to complete a description of the usage view of a logical block. By organizing all the Lprops objects into LPT b+tree, you can quickly query the usage view information that updates a lnum logical block. Since LPT's key is lnum, all logic blocks that cannot be quickly queried to most of the free or most dirty, based on this requirement, ubifs organize the lprops to meet the free Lnum (space allocation) or dirtry Fast query requirements for Lnum (garbage collection). LPTLPT B+tree is used to manage UBIFS Logical Block Property Objects Lprops,b+tree the index is lnum. The purpose is to quickly query and update the logic block information (mainly free, dirty, etc.) according to Lnum. --eof--

Ubifs Core objects-TNC and LPT

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.