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
199 mode=%s Control block allocation mode which supports "adaptive"
200 and "lfs". In "lfs" mode, there should be no random
203 with "mode=lfs".
217 layer. This supports "off", "user-based", and
218 "fs-based". In "off" mode (default), f2fs does not pass
219 down hints. In "user-based" mode, f2fs tries to pass
220 down hints given by users. And in "fs-based" mode, f2fs
225 "strict", and "nobarrier". In "posix" mode, which is
228 In "strict" mode, fsync will be heavy and behaves in line
232 non-atomic files likewise "nobarrier" mount option.
267 "lz4", "zstd" and "lzo-rle" algorithm.
271 lz4 3 - 16
272 zstd 1 - 22
273 compress_log_size=%u Support configuring compress cluster size, the size will
284 compress_chksum Support verifying chksum of raw data in compressed cluster.
285 compress_mode=%s Control file compression mode. This supports "fs" and "user"
286 modes. In "fs" mode (default), f2fs does automatic compression
287 on the compression enabled files. In "user" mode, f2fs disables
296 files using the blk-crypto framework rather than
297 filesystem-layer encryption. This allows the use of
298 inline encryption hardware. The on-disk format is
300 Documentation/block/inline-encryption.rst.
301 atgc Enable age-threshold garbage collection, it provides high
303 memory=%s Control memory mode. This supports "normal" and "low" modes.
304 "low" mode is introduced to support low memory devices.
305 Because of the nature of low memory devices, in this mode, f2fs
307 "normal" mode is the default mode and same as before.
308 age_extent_cache Enable an age extent cache based on rb-tree. It records
322 - major file system information managed by f2fs currently
323 - average SIT information about whole segments
324 - current memory footprint consumed by f2fs.
332 The files in each per-device directory are shown in table below.
335 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
353 # mkfs.f2fs -l label /dev/block_device
354 # mount -t f2fs /dev/block_device /mnt/f2fs
357 ---------
359 which builds a basic on-disk layout.
364 ``-l [label]`` Give a volume label, up to 512 unicode name.
365 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
368 ``-o [int]`` Set overprovision ratio in percent over volume size.
371 ``-s [int]`` Set the number of segments per section.
374 ``-z [int]`` Set the number of sections per zone.
377 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
378 ``-t [0 or 1]`` Disable discard command or not.
386 ---------
387 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
388 partition, which examines whether the filesystem metadata and user-made data
389 are cross-referenced correctly or not.
394 -d debug level [default:0]
399 ---------
403 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
404 It shows on-disk inode information recognized by a given inode number, and is
410 -d debug level [default:0]
411 -i inode no (hex)
412 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
413 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
417 # dump.f2fs -i [ino] /dev/sdx
418 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
419 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
424 ----------
431 -----------
432 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
438 -----------
446 -------
448 f2fs-specific ones, which is very useful for QA tests.
455 On-disk Layout
456 --------------
466 align with the zone size <-|
467 |-> align with the segment size
485 - Superblock (SB)
490 - Checkpoint (CP)
494 - Segment Information Table (SIT)
498 - Node Address Table (NAT)
502 - Segment Summary Area (SSA)
506 - Main Area
509 In order to avoid misalignment between file system and flash-based storage, F2FS
518 ------------------------------
529 +--------+----------+---------+
531 +--------+----------+---------+
535 +-------+-------+--------+--------+--------+--------+
537 +-------+-------+--------+--------+--------+--------+
540 `----------------------------------------'
543 ---------------
556 |- data (923)
557 |- direct node (2)
558 | `- data (1018)
559 |- indirect node (2)
560 | `- direct node (1018)
561 | `- data (1018)
562 `- double indirect node (1)
563 `- indirect node (1018)
564 `- direct node (1018)
565 `- data (1018)
573 -------------------
577 - hash hash value of the file name
578 - ino inode number
579 - len the length of file name
580 - type file type such as directory, symlink, etc
592 +--------------------------------+
594 +--------------------------------+
598 +--------+----------+----------+------------+
600 +--------+----------+----------+------------+
604 +------+------+-----+------+
606 +------+------+-----+------+
609 F2FS implements multi-level hash tables for directory structure. Each level has
615 ----------------------
619 ----------------------
623 level #1 | A(2B) - A(2B)
625 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
627 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
629 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
633 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
635 `- 4, Otherwise
637 ,- 2^(n + dir_level),
640 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
659 --------------> Dir <--------------
663 child - child [hole] - child
665 child - child - child [hole] - [hole] - child
672 ------------------------
677 - Hot node contains direct node blocks of directories.
678 - Warm node contains direct node blocks except hot node blocks.
679 - Cold node contains indirect node blocks
680 - Hot data contains dentry blocks
681 - Warm data contains data blocks except hot and cold data blocks
682 - Cold data contains multimedia data or migrated data blocks
684 LFS has two schemes for free space management: threaded log and copy-and-compac-
685 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
690 scheme where the copy-and-compaction scheme is adopted by default, but the
694 In order to align F2FS with underlying flash-based storage, F2FS allocates a
702 ----------------
704 F2FS does cleaning both on demand and in the background. On-demand cleaning is
709 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
711 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
714 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
721 Write-hint Policy
722 -----------------
726 2) whint_mode=user-based. F2FS tries to pass down hints given by
739 -- buffered io
747 -- direct io
756 3) whint_mode=fs-based. F2FS passes down hints with its policy.
768 -- buffered io
776 -- direct io
786 -------------------
791 The default operation (i.e., mode is zero) of fallocate() allocates
801 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addressess having
812 --------------------------
814 - New term named cluster is defined as basic unit of compression, file can
815 be divided into multiple clusters logically. One cluster includes 4 << n
816 (n >= 0) logical pages, compression size is also cluster size, each of
817 cluster can be compressed or not.
819 - In cluster metadata layout, one special block address is used to indicate
820 a cluster is a compressed one or normal one; for compressed cluster, following
821 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
824 - In order to eliminate write amplification during overwrite, F2FS only
825 support compression on write-once file, data can be compressed only when
826 all logical blocks in cluster contain valid data and compress ratio of
827 cluster data is lower than specified threshold.
829 - To enable compression on regular inode, there are three ways:
833 * mount w/ -o compress_extension=ext; touch file.ext
834 * mount w/ -o compress_extension=*; touch any_file
836 - At this point, compression feature doesn't expose compressed space to user
846 +-----------------------------------------------+
847 | cluster 1 | cluster 2 | ......... | cluster N |
848 +-----------------------------------------------+
851 . Compressed Cluster . . Normal Cluster .
852 +----------+---------+---------+---------+ +---------+---------+---------+---------+
854 +----------+---------+---------+---------+ +---------+---------+---------+---------+
858 +-------------+-------------+----------+----------------------------+
860 +-------------+-------------+----------+----------------------------+
862 Compression mode
863 --------------------------
891 ----------------------------
893 - ZNS defines a per-zone capacity which can be equal or less than the
894 zone-size. Zone-capacity is the number of usable blocks in the zone.
895 F2FS checks if zone-capacity is less than zone-size, if it is, then any
896 segment which starts after the zone-capacity is marked as not-free in
900 zone-capacity is not aligned to default segment size(2MB), then a segment
901 can start before the zone-capacity and span across zone-capacity boundary.
903 past the zone-capacity are considered unusable in these segments.