Architecture and principle Analysis of F2FS file System (II.)--Disk layout

Source: Internet
Author: User
analysis of disk layout of F2FS file system

F2FS divides the entire volume into segments, with a fixed size of 2 MB per Segment. Several successive segments constitute the section, and several successive Sections constitute the Zone. By default, a Zone large size is a section, and a section size is a Segment.

F2FS divides the entire volume into 6 areas, except for the Super Block (SUPERBLOCK,SB), where each of the remaining areas contains multiple segments.

3.1 Block (Blocks), segment (segments), section (Sections), storage area (Zone) 3.1.1 Blocks

(1) All block sizes for F2FS file systems are 4KB,F2FS code implicitly links the block size to the page size of the system, so F2FS cannot run on larger-page systems, such as IA64 and PowerPC.

(2) The block address is 32 bits, and the maximum file system is 2^ (32+12) Bytes, which is 16TB (completely larger than the current NAND flash device size).

3.1.2 Segments

(1) Continuous blocks set synthesis segments, one segment size is 512 blocks (i.e. 2MB);

(2) Each segment has a segment Summary block metadata structure that describes the owner of each block in the segment (the file to which it belongs and the offset of the block within the file). Segment summary is primarily used to identify which blocks data needs to be transferred to a new location when performing cleaning operations, and how to update the blocks's index information after the transfer. A block can completely store 512 blocks of summary information, and each blocks has a 1 bit extra space for other purposes.

(3) 2MB is the most suitable segment size, too large unsuitable, too small will cause storage summary information block space waste;

3.1.3 Sections

(1) Continuous segments set synthesis section. The number of segments in the section is arbitrary, but satisfies the power of 2; By default, a section size is equivalent to a segment (2^0 segments);

(2) A section corresponding to the log structuring of an area "region", log in the use of the next sections, usually to the beginning of the current to fill up data;

(3) The Cleaner of the cleaning device is processed one section at a time;

(4) In F2fs, there are 6 "open" sections at any given time, which are used to write different kinds of data (metadata, data) into each sections, and to achieve data separation. This allows the file content (data) to be separated from its index information (nodes, node), allowing the F2fs file system to divide the sections into three categories according to various heuristic methods: hot, warm, cold. For example, catalog data is treated as hot, separating it from file data and storing it in "Hot" section. Cold data is data that will not change over a long period of time, so a section that fills cold data does not need to perform a clean operation. For hot nodes (index information nodes), the general update quickly, after a period of time, filled in the hot node of the section of the valid data (alive data) will be very little, so the choice of such a section for clean operation is very small cost (because the data to be transferred is very little).


3.1.4 Zone

(1) Continuous sections set synthesis of zone. A zone can contain arbitrary integer sections. The default is a zone containing a section;

(2) The sole purpose of setting up zone is to place as many as 6 open sections in different child devices of the flash device. In theory, flash devices are usually made up of a set of completely independent sub devices, each child device can handle I/O requests individually, and different child devices can process I/O requests in parallel, and if the size of the zone is aligned with the child device size, 6 open sections can be written in parallel, taking full advantage of the device's characteristics ;

(3) The zone constitutes the "main" area of the F2FS. 3.1.5 Meta Area

F2FS has a "meta" area that contains a variety of metadata (such as the segment summary mentioned earlier), which is not based on standard log-structured pipelining, so more work is left for FTL to do. There are three ways to manage write operations on the meta area:

A) First, a small amount of read-only data (super blocks) is never written immediately when the file system is created;

b) Second, a simple local updating method for segment Summary block is introduced. This local update may result in the uncertainty of the data block "fix" content after the file system runs, but this is not a problem for segment summary, the data in segment summary blocks is validated before it is used, and if any information is lost, It will recover from other source in the recovery process.

c The third method, allocating the space of twice times the size of the demand space, makes each block have two different locations: a primary, a secondary, any moment, and only one block of two locations is a live state. Thus LFS's copy-on-write requirements can be easily implemented by writing the updated block content to the block at the non-live location and updating the location of the block in which the record is being live. For metadata, this technique is the primary implementation of the snapshot functionality. When creating a checkpoint, F2fs performs a small number of journaling updates to the last group, which in part eases the work of FTL.

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.