Lines Matching +full:multi +full:- +full:cluster
1 .. SPDX-License-Identifier: GPL-2.0
4 Flash-Friendly File System (F2FS)
10 NAND flash memory-based storage devices, such as SSD, eMMC, and SD cards, have
16 F2FS is a file system exploiting NAND flash memory-based storage devices, which
17 is based on Log-structured File System (LFS). The design has been focused on
21 Since a NAND flash memory-based storage device shows different characteristic
23 F2FS and its tools support various parameters not only for configuring on-disk
29 - git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git
33 - linux-f2fs-devel@lists.sourceforge.net
37 - https://bugzilla.kernel.org/enter_bug.cgi?product=File%20System&component=f2fs
42 Log-structured File System (LFS)
43 --------------------------------
44 "A log-structured file system writes all modifications to disk sequentially in
45 a log-like structure, thereby speeding up both file writing and crash recovery.
51 implementation of a log-structured file system", ACM Trans. Computer Systems
55 ----------------------
64 [1] Bityutskiy, A. 2005. JFFS3 design issues. http://www.linux-mtd.infradead.org/
67 -----------------
68 Since LFS is based on out-of-place writes, it produces so many obsolete blocks
78 3. It checks the cross-reference between the data and its parent index structure.
89 ---------------
90 - Enlarge the random write area for better performance, but provide the high
92 - Align FS data structures to the operational units in FTL as best efforts
95 ----------------------
96 - Use a term, “node”, that represents inodes as well as various pointer blocks
97 - Introduce Node Address Table (NAT) containing the locations of all the “node”
101 -----------------
102 - Support a background cleaning process
103 - Support greedy and cost-benefit algorithms for victim selection policies
104 - Support multi-head logs for static/dynamic hot and cold data separation
105 - Introduce adaptive logging for efficient block allocation
126 disable_roll_forward Disable the roll-forward recovery routine
127 norecovery Disable the roll-forward recovery routine, mounted read-
128 only (i.e., -o ro,disable_roll_forward)
129 discard/nodiscard Enable/disable real-time discard in f2fs, if discard is
167 extent_cache Enable an extent cache based on rb-tree, it can cache
171 noextent_cache Disable an extent cache based on rb-tree explicitly, see
224 fragmentation/after-GC situation itself. The developers use these
225 modes to understand filesystem fragmentation/after-GC condition well,
228 position. With this, we can simulate the after-GC condition.
239 recommend to re-format the filesystem after using these options.
262 non-atomic files likewise "nobarrier" mount option.
270 to re-enable checkpointing. Is enabled by default. While
297 "lz4", "zstd" and "lzo-rle" algorithm.
304 lz4 3 - 16
305 zstd 1 - 22
307 compress_log_size=%u Support configuring compress cluster size. The size will
329 compress_chksum Support verifying chksum of raw data in compressed cluster.
341 files using the blk-crypto framework rather than
342 filesystem-layer encryption. This allows the use of
343 inline encryption hardware. The on-disk format is
345 Documentation/block/inline-encryption.rst.
346 atgc Enable age-threshold garbage collection, it provides high
361 age_extent_cache Enable an age extent cache based on rb-tree. It records
366 "panic", "continue" and "remount-ro", respectively, trigger
368 the partition in read-only mode. By default it uses "continue"
372 mode continue remount-ro panic
375 syscall errors -EIO -EROFS N/A
378 pending non-dir write drop keep N/A
391 perf (Default) Enforces a hash-only lookup.
393 disabled, ignoring the on-disk flag.
397 different case-folding algorithm.
398 This mode ignores the on-disk flag.
400 on-disk `SB_ENC_NO_COMPAT_FALLBACK_FL`
413 - major file system information managed by f2fs currently
414 - average SIT information about whole segments
415 - current memory footprint consumed by f2fs.
423 The files in each per-device directory are shown in table below.
426 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
444 # mkfs.f2fs -l label /dev/block_device
445 # mount -t f2fs /dev/block_device /mnt/f2fs
448 ---------
450 which builds a basic on-disk layout.
455 ``-l [label]`` Give a volume label, up to 512 unicode name.
456 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
459 ``-o [int]`` Set overprovision ratio in percent over volume size.
462 ``-s [int]`` Set the number of segments per section.
465 ``-z [int]`` Set the number of sections per zone.
468 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
469 ``-t [0 or 1]`` Disable discard command or not.
477 ---------
478 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
479 partition, which examines whether the filesystem metadata and user-made data
480 are cross-referenced correctly or not.
485 -d debug level [default:0]
490 ---------
494 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
495 It shows on-disk inode information recognized by a given inode number, and is
501 -d debug level [default:0]
502 -i inode no (hex)
503 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
504 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
508 # dump.f2fs -i [ino] /dev/sdx
509 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
510 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
515 ----------
522 -----------
523 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
529 -----------
537 -------
539 f2fs-specific ones, which is very useful for QA tests.
546 On-disk Layout
547 --------------
557 align with the zone size <-|
558 |-> align with the segment size
576 - Superblock (SB)
581 - Checkpoint (CP)
585 - Segment Information Table (SIT)
589 - Node Address Table (NAT)
593 - Segment Summary Area (SSA)
597 - Main Area
600 In order to avoid misalignment between file system and flash-based storage, F2FS
609 ------------------------------
620 +--------+----------+---------+
622 +--------+----------+---------+
626 +-------+-------+--------+--------+--------+--------+
628 +-------+-------+--------+--------+--------+--------+
631 `----------------------------------------'
634 ---------------
647 |- data (923)
648 |- direct node (2)
649 | `- data (1018)
650 |- indirect node (2)
651 | `- direct node (1018)
652 | `- data (1018)
653 `- double indirect node (1)
654 `- indirect node (1018)
655 `- direct node (1018)
656 `- data (1018)
664 -------------------
668 - hash hash value of the file name
669 - ino inode number
670 - len the length of file name
671 - type file type such as directory, symlink, etc
683 +--------------------------------+
685 +--------------------------------+
689 +--------+----------+----------+------------+
691 +--------+----------+----------+------------+
695 +------+------+-----+------+
697 +------+------+-----+------+
700 F2FS implements multi-level hash tables for directory structure. Each level has
706 ----------------------
710 ----------------------
714 level #1 | A(2B) - A(2B)
716 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
718 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
720 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
724 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
726 `- 4, Otherwise
728 ,- 2^(n + dir_level),
731 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
750 --------------> Dir <--------------
754 child - child [hole] - child
756 child - child - child [hole] - [hole] - child
763 ------------------------
768 - Hot node contains direct node blocks of directories.
769 - Warm node contains direct node blocks except hot node blocks.
770 - Cold node contains indirect node blocks
771 - Hot data contains dentry blocks
772 - Warm data contains data blocks except hot and cold data blocks
773 - Cold data contains multimedia data or migrated data blocks
775 LFS has two schemes for free space management: threaded log and copy-and-compac-
776 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
781 scheme where the copy-and-compaction scheme is adopted by default, but the
785 In order to align F2FS with underlying flash-based storage, F2FS allocates a
793 ----------------
795 F2FS does cleaning both on demand and in the background. On-demand cleaning is
800 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
802 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
805 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
812 Write-hint Policy
813 -----------------
827 -- buffered io
828 ------------------------------------------------------------------
833 -- direct io
834 ------------------------------------------------------------------
844 -------------------
859 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addresses having
870 --------------------------
872 - New term named cluster is defined as basic unit of compression, file can
873 be divided into multiple clusters logically. One cluster includes 4 << n
874 (n >= 0) logical pages, compression size is also cluster size, each of
875 cluster can be compressed or not.
877 - In cluster metadata layout, one special block address is used to indicate
878 a cluster is a compressed one or normal one; for compressed cluster, following
879 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
882 - In order to eliminate write amplification during overwrite, F2FS only
883 support compression on write-once file, data can be compressed only when
884 all logical blocks in cluster contain valid data and compress ratio of
885 cluster data is lower than specified threshold.
887 - To enable compression on regular inode, there are four ways:
891 * mount w/ -o compress_extension=ext; touch file.ext
892 * mount w/ -o compress_extension=*; touch any_file
894 - To disable compression on regular inode, there are two ways:
896 * chattr -c file
897 * mount w/ -o nocompress_extension=ext; touch file.ext
899 - Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
903 should be compresse, bar.zip should be non-compressed. chattr +c dir/bar.zip
905 * compress_extension=so; nocompress_extension=zip; chattr -c dir; touch
907 compresse, bar.zip and baz.txt should be non-compressed.
911 - At this point, compression feature doesn't expose compressed space to user
925 +-----------------------------------------------+
926 | cluster 1 | cluster 2 | ......... | cluster N |
927 +-----------------------------------------------+
930 . Compressed Cluster . . Normal Cluster .
931 +----------+---------+---------+---------+ +---------+---------+---------+---------+
933 +----------+---------+---------+---------+ +---------+---------+---------+---------+
937 +-------------+-------------+----------+----------------------------+
939 +-------------+-------------+----------+----------------------------+
942 --------------------------
972 ----------------------------
974 - ZNS defines a per-zone capacity which can be equal or less than the
975 zone-size. Zone-capacity is the number of usable blocks in the zone.
976 F2FS checks if zone-capacity is less than zone-size, if it is, then any
977 segment which starts after the zone-capacity is marked as not-free in
981 zone-capacity is not aligned to default segment size(2MB), then a segment
982 can start before the zone-capacity and span across zone-capacity boundary.
984 past the zone-capacity are considered unusable in these segments.
987 -----------------------
999 .. code-block::
1004 # mkfs.f2fs -c /dev/vdc@vdc.file /dev/vdb
1006 # ls -l /mnt/f2fs
1008 # df -h
1011 # mount -o loop /dev/vdc /mnt/ext4
1012 # df -h
1023 # df -h