Lines Matching +full:multi +full:- +full:cluster
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
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
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
164 extent_cache Enable an extent cache based on rb-tree, it can cache
168 noextent_cache Disable an extent cache based on rb-tree explicitly, see
213 fragmentation/after-GC situation itself. The developers use these
214 modes to understand filesystem fragmentation/after-GC condition well,
217 position. With this, we can simulate the after-GC condition.
228 recommend to re-format the filesystem after using these options.
251 non-atomic files likewise "nobarrier" mount option.
286 "lz4", "zstd" and "lzo-rle" algorithm.
290 lz4 3 - 16
291 zstd 1 - 22
292 compress_log_size=%u Support configuring compress cluster size. The size will
314 compress_chksum Support verifying chksum of raw data in compressed cluster.
326 files using the blk-crypto framework rather than
327 filesystem-layer encryption. This allows the use of
328 inline encryption hardware. The on-disk format is
330 Documentation/block/inline-encryption.rst.
331 atgc Enable age-threshold garbage collection, it provides high
346 age_extent_cache Enable an age extent cache based on rb-tree. It records
351 "panic", "continue" and "remount-ro", respectively, trigger
353 the partition in read-only mode. By default it uses "continue"
356 mode continue remount-ro panic
359 syscall errors -EIO -EROFS N/A
362 pending non-dir write drop keep N/A
376 - major file system information managed by f2fs currently
377 - average SIT information about whole segments
378 - current memory footprint consumed by f2fs.
386 The files in each per-device directory are shown in table below.
389 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
407 # mkfs.f2fs -l label /dev/block_device
408 # mount -t f2fs /dev/block_device /mnt/f2fs
411 ---------
413 which builds a basic on-disk layout.
418 ``-l [label]`` Give a volume label, up to 512 unicode name.
419 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
422 ``-o [int]`` Set overprovision ratio in percent over volume size.
425 ``-s [int]`` Set the number of segments per section.
428 ``-z [int]`` Set the number of sections per zone.
431 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
432 ``-t [0 or 1]`` Disable discard command or not.
440 ---------
441 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
442 partition, which examines whether the filesystem metadata and user-made data
443 are cross-referenced correctly or not.
448 -d debug level [default:0]
453 ---------
457 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
458 It shows on-disk inode information recognized by a given inode number, and is
464 -d debug level [default:0]
465 -i inode no (hex)
466 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
467 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
471 # dump.f2fs -i [ino] /dev/sdx
472 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
473 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
478 ----------
485 -----------
486 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
492 -----------
500 -------
502 f2fs-specific ones, which is very useful for QA tests.
509 On-disk Layout
510 --------------
520 align with the zone size <-|
521 |-> align with the segment size
539 - Superblock (SB)
544 - Checkpoint (CP)
548 - Segment Information Table (SIT)
552 - Node Address Table (NAT)
556 - Segment Summary Area (SSA)
560 - Main Area
563 In order to avoid misalignment between file system and flash-based storage, F2FS
572 ------------------------------
583 +--------+----------+---------+
585 +--------+----------+---------+
589 +-------+-------+--------+--------+--------+--------+
591 +-------+-------+--------+--------+--------+--------+
594 `----------------------------------------'
597 ---------------
610 |- data (923)
611 |- direct node (2)
612 | `- data (1018)
613 |- indirect node (2)
614 | `- direct node (1018)
615 | `- data (1018)
616 `- double indirect node (1)
617 `- indirect node (1018)
618 `- direct node (1018)
619 `- data (1018)
627 -------------------
631 - hash hash value of the file name
632 - ino inode number
633 - len the length of file name
634 - type file type such as directory, symlink, etc
646 +--------------------------------+
648 +--------------------------------+
652 +--------+----------+----------+------------+
654 +--------+----------+----------+------------+
658 +------+------+-----+------+
660 +------+------+-----+------+
663 F2FS implements multi-level hash tables for directory structure. Each level has
669 ----------------------
673 ----------------------
677 level #1 | A(2B) - A(2B)
679 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
681 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
683 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
687 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
689 `- 4, Otherwise
691 ,- 2^(n + dir_level),
694 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
713 --------------> Dir <--------------
717 child - child [hole] - child
719 child - child - child [hole] - [hole] - child
726 ------------------------
731 - Hot node contains direct node blocks of directories.
732 - Warm node contains direct node blocks except hot node blocks.
733 - Cold node contains indirect node blocks
734 - Hot data contains dentry blocks
735 - Warm data contains data blocks except hot and cold data blocks
736 - Cold data contains multimedia data or migrated data blocks
738 LFS has two schemes for free space management: threaded log and copy-and-compac-
739 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
744 scheme where the copy-and-compaction scheme is adopted by default, but the
748 In order to align F2FS with underlying flash-based storage, F2FS allocates a
756 ----------------
758 F2FS does cleaning both on demand and in the background. On-demand cleaning is
763 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
765 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
768 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
776 -------------------
791 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addresses having
802 --------------------------
804 - New term named cluster is defined as basic unit of compression, file can
805 be divided into multiple clusters logically. One cluster includes 4 << n
806 (n >= 0) logical pages, compression size is also cluster size, each of
807 cluster can be compressed or not.
809 - In cluster metadata layout, one special block address is used to indicate
810 a cluster is a compressed one or normal one; for compressed cluster, following
811 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
814 - In order to eliminate write amplification during overwrite, F2FS only
815 support compression on write-once file, data can be compressed only when
816 all logical blocks in cluster contain valid data and compress ratio of
817 cluster data is lower than specified threshold.
819 - To enable compression on regular inode, there are four ways:
823 * mount w/ -o compress_extension=ext; touch file.ext
824 * mount w/ -o compress_extension=*; touch any_file
826 - To disable compression on regular inode, there are two ways:
828 * chattr -c file
829 * mount w/ -o nocompress_extension=ext; touch file.ext
831 - Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
835 should be compresse, bar.zip should be non-compressed. chattr +c dir/bar.zip
837 * compress_extension=so; nocompress_extension=zip; chattr -c dir; touch
839 compresse, bar.zip and baz.txt should be non-compressed.
843 - At this point, compression feature doesn't expose compressed space to user
857 +-----------------------------------------------+
858 | cluster 1 | cluster 2 | ......... | cluster N |
859 +-----------------------------------------------+
862 . Compressed Cluster . . Normal Cluster .
863 +----------+---------+---------+---------+ +---------+---------+---------+---------+
865 +----------+---------+---------+---------+ +---------+---------+---------+---------+
869 +-------------+-------------+----------+----------------------------+
871 +-------------+-------------+----------+----------------------------+
874 --------------------------
902 ----------------------------
904 - ZNS defines a per-zone capacity which can be equal or less than the
905 zone-size. Zone-capacity is the number of usable blocks in the zone.
906 F2FS checks if zone-capacity is less than zone-size, if it is, then any
907 segment which starts after the zone-capacity is marked as not-free in
911 zone-capacity is not aligned to default segment size(2MB), then a segment
912 can start before the zone-capacity and span across zone-capacity boundary.
914 past the zone-capacity are considered unusable in these segments.