Lines Matching +full:nand +full:- +full:keep +full:- +full:config
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
219 fragmentation/after-GC situation itself. The developers use these
220 modes to understand filesystem fragmentation/after-GC condition well,
223 position. With this, we can simulate the after-GC condition.
234 recommend to re-format the filesystem after using these options.
257 non-atomic files likewise "nobarrier" mount option.
292 "lz4", "zstd" and "lzo-rle" algorithm.
294 "lz4" and "zstd" support compress level config.
296 lz4 3 - 16
297 zstd 1 - 22
332 files using the blk-crypto framework rather than
333 filesystem-layer encryption. This allows the use of
334 inline encryption hardware. The on-disk format is
336 Documentation/block/inline-encryption.rst.
337 atgc Enable age-threshold garbage collection, it provides high
352 age_extent_cache Enable an age extent cache based on rb-tree. It records
357 "panic", "continue" and "remount-ro", respectively, trigger
359 the partition in read-only mode. By default it uses "continue"
362 mode continue remount-ro panic
365 syscall errors -EIO -EROFS N/A
367 pending dir write keep keep N/A
368 pending non-dir write drop keep N/A
369 pending node write drop keep N/A
370 pending meta write keep keep N/A
381 perf (Default) Enforces a hash-only lookup.
383 disabled, ignoring the on-disk flag.
387 different case-folding algorithm.
388 This mode ignores the on-disk flag.
390 on-disk `SB_ENC_NO_COMPAT_FALLBACK_FL`
403 - major file system information managed by f2fs currently
404 - average SIT information about whole segments
405 - current memory footprint consumed by f2fs.
413 The files in each per-device directory are shown in table below.
416 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
434 # mkfs.f2fs -l label /dev/block_device
435 # mount -t f2fs /dev/block_device /mnt/f2fs
438 ---------
440 which builds a basic on-disk layout.
445 ``-l [label]`` Give a volume label, up to 512 unicode name.
446 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
449 ``-o [int]`` Set overprovision ratio in percent over volume size.
452 ``-s [int]`` Set the number of segments per section.
455 ``-z [int]`` Set the number of sections per zone.
458 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
459 ``-t [0 or 1]`` Disable discard command or not.
467 ---------
468 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
469 partition, which examines whether the filesystem metadata and user-made data
470 are cross-referenced correctly or not.
475 -d debug level [default:0]
480 ---------
484 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
485 It shows on-disk inode information recognized by a given inode number, and is
491 -d debug level [default:0]
492 -i inode no (hex)
493 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
494 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
498 # dump.f2fs -i [ino] /dev/sdx
499 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
500 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
505 ----------
512 -----------
513 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
519 -----------
527 -------
529 f2fs-specific ones, which is very useful for QA tests.
536 On-disk Layout
537 --------------
547 align with the zone size <-|
548 |-> align with the segment size
566 - Superblock (SB)
571 - Checkpoint (CP)
575 - Segment Information Table (SIT)
579 - Node Address Table (NAT)
583 - Segment Summary Area (SSA)
587 - Main Area
590 In order to avoid misalignment between file system and flash-based storage, F2FS
599 ------------------------------
610 +--------+----------+---------+
612 +--------+----------+---------+
616 +-------+-------+--------+--------+--------+--------+
618 +-------+-------+--------+--------+--------+--------+
621 `----------------------------------------'
624 ---------------
637 |- data (923)
638 |- direct node (2)
639 | `- data (1018)
640 |- indirect node (2)
641 | `- direct node (1018)
642 | `- data (1018)
643 `- double indirect node (1)
644 `- indirect node (1018)
645 `- direct node (1018)
646 `- data (1018)
654 -------------------
658 - hash hash value of the file name
659 - ino inode number
660 - len the length of file name
661 - type file type such as directory, symlink, etc
673 +--------------------------------+
675 +--------------------------------+
679 +--------+----------+----------+------------+
681 +--------+----------+----------+------------+
685 +------+------+-----+------+
687 +------+------+-----+------+
690 F2FS implements multi-level hash tables for directory structure. Each level has
696 ----------------------
700 ----------------------
704 level #1 | A(2B) - A(2B)
706 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
708 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
710 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
714 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
716 `- 4, Otherwise
718 ,- 2^(n + dir_level),
721 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
740 --------------> Dir <--------------
744 child - child [hole] - child
746 child - child - child [hole] - [hole] - child
753 ------------------------
758 - Hot node contains direct node blocks of directories.
759 - Warm node contains direct node blocks except hot node blocks.
760 - Cold node contains indirect node blocks
761 - Hot data contains dentry blocks
762 - Warm data contains data blocks except hot and cold data blocks
763 - Cold data contains multimedia data or migrated data blocks
765 LFS has two schemes for free space management: threaded log and copy-and-compac-
766 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
771 scheme where the copy-and-compaction scheme is adopted by default, but the
775 In order to align F2FS with underlying flash-based storage, F2FS allocates a
783 ----------------
785 F2FS does cleaning both on demand and in the background. On-demand cleaning is
790 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
792 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
795 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
802 Write-hint Policy
803 -----------------
817 -- buffered io
822 -- direct io
832 -------------------
847 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addresses having
858 --------------------------
860 - New term named cluster is defined as basic unit of compression, file can
865 - In cluster metadata layout, one special block address is used to indicate
867 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
870 - In order to eliminate write amplification during overwrite, F2FS only
871 support compression on write-once file, data can be compressed only when
875 - To enable compression on regular inode, there are four ways:
879 * mount w/ -o compress_extension=ext; touch file.ext
880 * mount w/ -o compress_extension=*; touch any_file
882 - To disable compression on regular inode, there are two ways:
884 * chattr -c file
885 * mount w/ -o nocompress_extension=ext; touch file.ext
887 - Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
891 should be compresse, bar.zip should be non-compressed. chattr +c dir/bar.zip
893 * compress_extension=so; nocompress_extension=zip; chattr -c dir; touch
895 compresse, bar.zip and baz.txt should be non-compressed.
899 - At this point, compression feature doesn't expose compressed space to user
913 +-----------------------------------------------+
915 +-----------------------------------------------+
919 +----------+---------+---------+---------+ +---------+---------+---------+---------+
921 +----------+---------+---------+---------+ +---------+---------+---------+---------+
925 +-------------+-------------+----------+----------------------------+
927 +-------------+-------------+----------+----------------------------+
930 --------------------------
958 ----------------------------
960 - ZNS defines a per-zone capacity which can be equal or less than the
961 zone-size. Zone-capacity is the number of usable blocks in the zone.
962 F2FS checks if zone-capacity is less than zone-size, if it is, then any
963 segment which starts after the zone-capacity is marked as not-free in
967 zone-capacity is not aligned to default segment size(2MB), then a segment
968 can start before the zone-capacity and span across zone-capacity boundary.
970 past the zone-capacity are considered unusable in these segments.
973 -----------------------
985 <use-case>
990 # mkfs.f2fs -c /dev/vdc@vdc.file /dev/vdb
992 # ls -l /mnt/f2fs
994 # df -h
997 # mount -o loop /dev/vdc /mnt/ext4
998 # df -h
1009 # df -h