F2FS Source Code Analysis (v) node management structure carding

Source: Internet
Author: User

Node is F2FS important management structure, it is very important! Once the system is mounted, there will be a node manager with the F2FS_NM_INFO structure to manage node allocations. The most puzzling of F2fs_nm_info is a few cardinal trees:

 490 structF2fs_nm_info {491block_t nat_blkaddr;/*base disk address of NAT*/ 492nid_t Max_nid;/*Maximum possible node IDs*/ 494nid_t Next_scan_nid;/*The next nid to be scanned*/ 497     /*NAT Cache Management*/ 498     structRadix_tree_root Nat_root;/*root of the NAT entry cache*/ 499     structRadix_tree_root Nat_set_root;/*root of the NAT set cache*/ 501     structList_head nat_entries;/*Cached NAT Entry List (clean)*/ 502Unsignedintnat_cnt;/*The # of cached NAT entries*/ 503Unsignedintdirty_nat_cnt;/*Total num of NAT entries in set*/ 505     /*Free node IDs management*/ 506     structRadix_tree_root Free_nid_root;/*root of the Free_nid cache*/ 507     structList_head free_nid_list;/*a list for free NIDs*/ 509Unsignedintfcnt;/*The number of the free node ID*/  +     /*For checkpoint*/ 513     Char*nat_bitmap;/*NAT Bitmap Pointer*/ 514     intBitmap_size;/*Bitmap Size*/ 515};

The three cardinal trees were: nat_root, Nat_set_root, Free_nid_root;

First, for the entire node manager, a core structure is node_info:

  $ structNode_info { -nid_t nid;/*Node ID*/  -nid_t ino;/*Inode number of the node ' s owner*/  theblock_t blk_addr;/*Block address of the node*/  -UnsignedCharVersion/*version of the node*/ WuyiUnsignedCharFlag/*For node information bits*/  the };  -   Wu structNat_entry { -     structList_head list;/*For clean or dirty NAT list*/  About     structNode_info ni;/*in-memory Node Information*/  $};

found that Node_info and f2fs_nat_entry "storage on disk" Look much like, even more than the struct f2fs_nat_entry a flag bit to represent some of the properties of this node!

266 struct F2fs_nat_entry {
267 __u8 version; /* */268 __le32 ino; /* */269 __le32 block_addr; /* * * __packed};

This core data structure is controlled by two structures: one is the cardinality tree "responsible for indexing" and the other is a linked list.

F2FS Source Code Analysis (v) node management structure carding

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.