Lines Matching +full:main +full:- +full:storage
1 .. SPDX-License-Identifier: GPL-2.0
4 WHAT IS Flash-Friendly File System (F2FS)?
7 NAND flash memory-based storage devices, such as SSD, eMMC, and SD cards, have
10 disks, a file system, an upper layer to the storage device, should adapt to the
13 F2FS is a file system exploiting NAND flash memory-based storage devices, which
14 is based on Log-structured File System (LFS). The design has been focused on
18 Since a NAND flash memory-based storage device shows different characteristic
20 F2FS and its tools support various parameters not only for configuring on-disk
26 - git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git
30 - linux-f2fs-devel@lists.sourceforge.net
34 - https://bugzilla.kernel.org/enter_bug.cgi?product=File%20System&component=f2fs
39 Log-structured File System (LFS)
40 --------------------------------
41 "A log-structured file system writes all modifications to disk sequentially in
42 a log-like structure, thereby speeding up both file writing and crash recovery.
48 implementation of a log-structured file system", ACM Trans. Computer Systems
52 ----------------------
61 [1] Bityutskiy, A. 2005. JFFS3 design issues. http://www.linux-mtd.infradead.org/
64 -----------------
65 Since LFS is based on out-of-place writes, it produces so many obsolete blocks
66 scattered across the whole storage. In order to serve new empty log space, it
75 3. It checks the cross-reference between the data and its parent index structure.
86 ---------------
87 - Enlarge the random write area for better performance, but provide the high
89 - Align FS data structures to the operational units in FTL as best efforts
92 ----------------------
93 - Use a term, “node”, that represents inodes as well as various pointer blocks
94 - Introduce Node Address Table (NAT) containing the locations of all the “node”
98 -----------------
99 - Support a background cleaning process
100 - Support greedy and cost-benefit algorithms for victim selection policies
101 - Support multi-head logs for static/dynamic hot and cold data separation
102 - Introduce adaptive logging for efficient block allocation
123 disable_roll_forward Disable the roll-forward recovery routine
124 norecovery Disable the roll-forward recovery routine, mounted read-
125 only (i.e., -o ro,disable_roll_forward)
126 discard/nodiscard Enable/disable real-time discard in f2fs, if discard is
129 no_heap Disable heap-style segment allocation which finds free
130 segments for data from the beginning of main area, while
131 for node from the end of main area.
156 nobarrier This option can be used if underlying storage guarantees
166 extent_cache Enable an extent cache based on rb-tree, it can cache
170 noextent_cache Disable an extent cache based on rb-tree explicitly, see
212 writes towards main area.
215 fragmentation/after-GC situation itself. The developers use these
216 modes to understand filesystem fragmentation/after-GC condition well,
219 position. With this, we can simulate the after-GC condition.
230 recommend to re-format the filesystem after using these options.
255 non-atomic files likewise "nobarrier" mount option.
290 "lz4", "zstd" and "lzo-rle" algorithm.
294 lz4 3 - 16
295 zstd 1 - 22
330 files using the blk-crypto framework rather than
331 filesystem-layer encryption. This allows the use of
332 inline encryption hardware. The on-disk format is
334 Documentation/block/inline-encryption.rst.
335 atgc Enable age-threshold garbage collection, it provides high
350 age_extent_cache Enable an age extent cache based on rb-tree. It records
355 "panic", "continue" and "remount-ro", respectively, trigger
357 the partition in read-only mode. By default it uses "continue"
360 mode continue remount-ro panic
363 syscall errors -EIO -EROFS N/A
366 pending non-dir write drop keep N/A
380 - major file system information managed by f2fs currently
381 - average SIT information about whole segments
382 - current memory footprint consumed by f2fs.
390 The files in each per-device directory are shown in table below.
393 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
411 # mkfs.f2fs -l label /dev/block_device
412 # mount -t f2fs /dev/block_device /mnt/f2fs
415 ---------
417 which builds a basic on-disk layout.
422 ``-l [label]`` Give a volume label, up to 512 unicode name.
423 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
426 ``-o [int]`` Set overprovision ratio in percent over volume size.
429 ``-s [int]`` Set the number of segments per section.
432 ``-z [int]`` Set the number of sections per zone.
435 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
436 ``-t [0 or 1]`` Disable discard command or not.
444 ---------
445 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
446 partition, which examines whether the filesystem metadata and user-made data
447 are cross-referenced correctly or not.
452 -d debug level [default:0]
457 ---------
461 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
462 It shows on-disk inode information recognized by a given inode number, and is
468 -d debug level [default:0]
469 -i inode no (hex)
470 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
471 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
475 # dump.f2fs -i [ino] /dev/sdx
476 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
477 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
482 ----------
489 -----------
490 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
496 -----------
504 -------
506 f2fs-specific ones, which is very useful for QA tests.
513 On-disk Layout
514 --------------
524 align with the zone size <-|
525 |-> align with the segment size
528 | Superblock | Checkpoint | Info. | Address | Summary | Main |
543 - Superblock (SB)
548 - Checkpoint (CP)
552 - Segment Information Table (SIT)
556 - Node Address Table (NAT)
558 Main area.
560 - Segment Summary Area (SSA)
562 data and node blocks stored in Main area.
564 - Main Area
567 In order to avoid misalignment between file system and flash-based storage, F2FS
569 start block address of Main area with the zone size by reserving some segments
576 ------------------------------
587 +--------+----------+---------+
589 +--------+----------+---------+
593 +-------+-------+--------+--------+--------+--------+
595 +-------+-------+--------+--------+--------+--------+
598 `----------------------------------------'
601 ---------------
614 |- data (923)
615 |- direct node (2)
616 | `- data (1018)
617 |- indirect node (2)
618 | `- direct node (1018)
619 | `- data (1018)
620 `- double indirect node (1)
621 `- indirect node (1018)
622 `- direct node (1018)
623 `- data (1018)
631 -------------------
635 - hash hash value of the file name
636 - ino inode number
637 - len the length of file name
638 - type file type such as directory, symlink, etc
650 +--------------------------------+
652 +--------------------------------+
656 +--------+----------+----------+------------+
658 +--------+----------+----------+------------+
662 +------+------+-----+------+
664 +------+------+-----+------+
667 F2FS implements multi-level hash tables for directory structure. Each level has
673 ----------------------
677 ----------------------
681 level #1 | A(2B) - A(2B)
683 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
685 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
687 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
691 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
693 `- 4, Otherwise
695 ,- 2^(n + dir_level),
698 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
717 --------------> Dir <--------------
721 child - child [hole] - child
723 child - child - child [hole] - [hole] - child
730 ------------------------
732 At runtime, F2FS manages six active logs inside "Main" area: Hot/Warm/Cold node
735 - Hot node contains direct node blocks of directories.
736 - Warm node contains direct node blocks except hot node blocks.
737 - Cold node contains indirect node blocks
738 - Hot data contains dentry blocks
739 - Warm data contains data blocks except hot and cold data blocks
740 - Cold data contains multimedia data or migrated data blocks
742 LFS has two schemes for free space management: threaded log and copy-and-compac-
743 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
748 scheme where the copy-and-compaction scheme is adopted by default, but the
752 In order to align F2FS with underlying flash-based storage, F2FS allocates a
760 ----------------
762 F2FS does cleaning both on demand and in the background. On-demand cleaning is
767 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
769 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
772 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
777 bitmap is composed of a bit stream covering whole blocks in main area.
780 -------------------
795 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addresses having
806 --------------------------
808 - New term named cluster is defined as basic unit of compression, file can
813 - In cluster metadata layout, one special block address is used to indicate
815 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
818 - In order to eliminate write amplification during overwrite, F2FS only
819 support compression on write-once file, data can be compressed only when
823 - To enable compression on regular inode, there are four ways:
827 * mount w/ -o compress_extension=ext; touch file.ext
828 * mount w/ -o compress_extension=*; touch any_file
830 - To disable compression on regular inode, there are two ways:
832 * chattr -c file
833 * mount w/ -o nocompress_extension=ext; touch file.ext
835 - Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
839 should be compresse, bar.zip should be non-compressed. chattr +c dir/bar.zip
841 * compress_extension=so; nocompress_extension=zip; chattr -c dir; touch
843 compresse, bar.zip and baz.txt should be non-compressed.
847 - At this point, compression feature doesn't expose compressed space to user
849 Instead, the main goal is to reduce data writes to flash disk as much as
861 +-----------------------------------------------+
863 +-----------------------------------------------+
867 +----------+---------+---------+---------+ +---------+---------+---------+---------+
869 +----------+---------+---------+---------+ +---------+---------+---------+---------+
873 +-------------+-------------+----------+----------------------------+
875 +-------------+-------------+----------+----------------------------+
878 --------------------------
906 ----------------------------
908 - ZNS defines a per-zone capacity which can be equal or less than the
909 zone-size. Zone-capacity is the number of usable blocks in the zone.
910 F2FS checks if zone-capacity is less than zone-size, if it is, then any
911 segment which starts after the zone-capacity is marked as not-free in
915 zone-capacity is not aligned to default segment size(2MB), then a segment
916 can start before the zone-capacity and span across zone-capacity boundary.
918 past the zone-capacity are considered unusable in these segments.