Lines Matching +full:cluster +full:- +full:mode
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
35 Log-structured File System (LFS)
36 --------------------------------
37 "A log-structured file system writes all modifications to disk sequentially in
38 a log-like structure, thereby speeding up both file writing and crash recovery.
44 implementation of a log-structured file system", ACM Trans. Computer Systems
48 ----------------------
57 [1] Bityutskiy, A. 2005. JFFS3 design issues. http://www.linux-mtd.infradead.org/
60 -----------------
61 Since LFS is based on out-of-place writes, it produces so many obsolete blocks
71 3. It checks the cross-reference between the data and its parent index structure.
82 ---------------
83 - Enlarge the random write area for better performance, but provide the high
85 - Align FS data structures to the operational units in FTL as best efforts
88 ----------------------
89 - Use a term, “node”, that represents inodes as well as various pointer blocks
90 - Introduce Node Address Table (NAT) containing the locations of all the “node”
94 -----------------
95 - Support a background cleaning process
96 - Support greedy and cost-benefit algorithms for victim selection policies
97 - Support multi-head logs for static/dynamic hot and cold data separation
98 - Introduce adaptive logging for efficient block allocation
119 disable_roll_forward Disable the roll-forward recovery routine
120 norecovery Disable the roll-forward recovery routine, mounted read-
121 only (i.e., -o ro,disable_roll_forward)
122 discard/nodiscard Enable/disable real-time discard in f2fs, if discard is
125 no_heap Disable heap-style segment allocation which finds free
160 extent_cache Enable an extent cache based on rb-tree, it can cache
164 noextent_cache Disable an extent cache based on rb-tree explicitly, see
203 mode=%s Control block allocation mode which supports "adaptive"
204 and "lfs". In "lfs" mode, there should be no random
208 fragmentation/after-GC situation itself. The developers use these
209 modes to understand filesystem fragmentation/after-GC condition well,
212 position. With this, we can simulate the after-GC condition.
216 it close to realistic IO pattern. So, in this mode, f2fs will allocate
223 recommend to re-format the filesystem after using these options.
225 with "mode=lfs".
241 "strict", and "nobarrier". In "posix" mode, which is
244 In "strict" mode, fsync will be heavy and behaves in line
248 non-atomic files likewise "nobarrier" mount option.
283 "lz4", "zstd" and "lzo-rle" algorithm.
287 lz4 3 - 16
288 zstd 1 - 22
289 compress_log_size=%u Support configuring compress cluster size. The size will
311 compress_chksum Support verifying chksum of raw data in compressed cluster.
312 compress_mode=%s Control file compression mode. This supports "fs" and "user"
313 modes. In "fs" mode (default), f2fs does automatic compression
314 on the compression enabled files. In "user" mode, f2fs disables
323 files using the blk-crypto framework rather than
324 filesystem-layer encryption. This allows the use of
325 inline encryption hardware. The on-disk format is
327 Documentation/block/inline-encryption.rst.
328 atgc Enable age-threshold garbage collection, it provides high
338 memory=%s Control memory mode. This supports "normal" and "low" modes.
339 "low" mode is introduced to support low memory devices.
340 Because of the nature of low memory devices, in this mode, f2fs
342 "normal" mode is the default mode and same as before.
353 - major file system information managed by f2fs currently
354 - average SIT information about whole segments
355 - current memory footprint consumed by f2fs.
363 The files in each per-device directory are shown in table below.
366 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
384 # mkfs.f2fs -l label /dev/block_device
385 # mount -t f2fs /dev/block_device /mnt/f2fs
388 ---------
390 which builds a basic on-disk layout.
395 ``-l [label]`` Give a volume label, up to 512 unicode name.
396 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
399 ``-o [int]`` Set overprovision ratio in percent over volume size.
402 ``-s [int]`` Set the number of segments per section.
405 ``-z [int]`` Set the number of sections per zone.
408 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
409 ``-t [0 or 1]`` Disable discard command or not.
417 ---------
418 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
419 partition, which examines whether the filesystem metadata and user-made data
420 are cross-referenced correctly or not.
425 -d debug level [default:0]
430 ---------
434 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
435 It shows on-disk inode information recognized by a given inode number, and is
441 -d debug level [default:0]
442 -i inode no (hex)
443 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
444 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
448 # dump.f2fs -i [ino] /dev/sdx
449 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
450 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
455 ----------
462 -----------
463 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
469 -----------
477 -------
479 f2fs-specific ones, which is very useful for QA tests.
486 On-disk Layout
487 --------------
497 align with the zone size <-|
498 |-> align with the segment size
516 - Superblock (SB)
521 - Checkpoint (CP)
525 - Segment Information Table (SIT)
529 - Node Address Table (NAT)
533 - Segment Summary Area (SSA)
537 - Main Area
540 In order to avoid misalignment between file system and flash-based storage, F2FS
549 ------------------------------
560 +--------+----------+---------+
562 +--------+----------+---------+
566 +-------+-------+--------+--------+--------+--------+
568 +-------+-------+--------+--------+--------+--------+
571 `----------------------------------------'
574 ---------------
587 |- data (923)
588 |- direct node (2)
589 | `- data (1018)
590 |- indirect node (2)
591 | `- direct node (1018)
592 | `- data (1018)
593 `- double indirect node (1)
594 `- indirect node (1018)
595 `- direct node (1018)
596 `- data (1018)
604 -------------------
608 - hash hash value of the file name
609 - ino inode number
610 - len the length of file name
611 - type file type such as directory, symlink, etc
623 +--------------------------------+
625 +--------------------------------+
629 +--------+----------+----------+------------+
631 +--------+----------+----------+------------+
635 +------+------+-----+------+
637 +------+------+-----+------+
640 F2FS implements multi-level hash tables for directory structure. Each level has
646 ----------------------
650 ----------------------
654 level #1 | A(2B) - A(2B)
656 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
658 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
660 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
664 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
666 `- 4, Otherwise
668 ,- 2^(n + dir_level),
671 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
690 --------------> Dir <--------------
694 child - child [hole] - child
696 child - child - child [hole] - [hole] - child
703 ------------------------
708 - Hot node contains direct node blocks of directories.
709 - Warm node contains direct node blocks except hot node blocks.
710 - Cold node contains indirect node blocks
711 - Hot data contains dentry blocks
712 - Warm data contains data blocks except hot and cold data blocks
713 - Cold data contains multimedia data or migrated data blocks
715 LFS has two schemes for free space management: threaded log and copy-and-compac-
716 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
721 scheme where the copy-and-compaction scheme is adopted by default, but the
725 In order to align F2FS with underlying flash-based storage, F2FS allocates a
733 ----------------
735 F2FS does cleaning both on demand and in the background. On-demand cleaning is
740 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
742 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
745 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
753 -------------------
758 The default operation (i.e., mode is zero) of fallocate() allocates
768 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addressess having
779 --------------------------
781 - New term named cluster is defined as basic unit of compression, file can
782 be divided into multiple clusters logically. One cluster includes 4 << n
783 (n >= 0) logical pages, compression size is also cluster size, each of
784 cluster can be compressed or not.
786 - In cluster metadata layout, one special block address is used to indicate
787 a cluster is a compressed one or normal one; for compressed cluster, following
788 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
791 - In order to eliminate write amplification during overwrite, F2FS only
792 support compression on write-once file, data can be compressed only when
793 all logical blocks in cluster contain valid data and compress ratio of
794 cluster data is lower than specified threshold.
796 - To enable compression on regular inode, there are four ways:
800 * mount w/ -o compress_extension=ext; touch file.ext
801 * mount w/ -o compress_extension=*; touch any_file
803 - To disable compression on regular inode, there are two ways:
805 * chattr -c file
806 * mount w/ -o nocompress_extension=ext; touch file.ext
808 - Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
812 should be compresse, bar.zip should be non-compressed. chattr +c dir/bar.zip
814 * compress_extension=so; nocompress_extension=zip; chattr -c dir; touch
816 compresse, bar.zip and baz.txt should be non-compressed.
820 - At this point, compression feature doesn't expose compressed space to user
834 +-----------------------------------------------+
835 | cluster 1 | cluster 2 | ......... | cluster N |
836 +-----------------------------------------------+
839 . Compressed Cluster . . Normal Cluster .
840 +----------+---------+---------+---------+ +---------+---------+---------+---------+
842 +----------+---------+---------+---------+ +---------+---------+---------+---------+
846 +-------------+-------------+----------+----------------------------+
848 +-------------+-------------+----------+----------------------------+
850 Compression mode
851 --------------------------
879 ----------------------------
881 - ZNS defines a per-zone capacity which can be equal or less than the
882 zone-size. Zone-capacity is the number of usable blocks in the zone.
883 F2FS checks if zone-capacity is less than zone-size, if it is, then any
884 segment which starts after the zone-capacity is marked as not-free in
888 zone-capacity is not aligned to default segment size(2MB), then a segment
889 can start before the zone-capacity and span across zone-capacity boundary.
891 past the zone-capacity are considered unusable in these segments.