Lines Matching +full:directory +full:- +full:based
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
113 disable_roll_forward Disable the roll-forward recovery routine
114 norecovery Disable the roll-forward recovery routine, mounted read-
115 only (i.e., -o ro,disable_roll_forward)
116 discard/nodiscard Enable/disable real-time discard in f2fs, if discard is
119 no_heap Disable heap-style segment allocation which finds free
138 directory entries can be written into inode block. The
154 extent_cache Enable an extent cache based on rb-tree, it can cache
158 noextent_cache Disable an extent cache based on rb-tree explicitly, see
204 prjjquota=<file> <quota file>: must be in root directory;
212 layer. This supports "off", "user-based", and
213 "fs-based". In "off" mode (default), f2fs does not pass
214 down hints. In "user-based" mode, f2fs tries to pass
215 down hints given by users. And in "fs-based" mode, f2fs
226 based on "posix", but doesn't issue flush command for
227 non-atomic files likewise "nobarrier" mount option.
251 "lz4", "zstd" and "lzo-rle" algorithm.
264 files using the blk-crypto framework rather than
265 filesystem-layer encryption. This allows the use of
266 inline encryption hardware. The on-disk format is
268 Documentation/block/inline-encryption.rst.
269 atgc Enable age-threshold garbage collection, it provides high
281 - major file system information managed by f2fs currently
282 - average SIT information about whole segments
283 - current memory footprint consumed by f2fs.
289 /sys/fs/f2fs. Each mounted filesystem will have a directory in
290 /sys/fs/f2fs based on its device name (i.e., /sys/fs/f2fs/sda).
291 The files in each per-device directory are shown in table below.
294 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
306 3. Create a directory to use when mounting::
312 # mkfs.f2fs -l label /dev/block_device
313 # mount -t f2fs /dev/block_device /mnt/f2fs
316 ---------
318 which builds a basic on-disk layout.
323 ``-l [label]`` Give a volume label, up to 512 unicode name.
324 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
327 ``-o [int]`` Set overprovision ratio in percent over volume size.
330 ``-s [int]`` Set the number of segments per section.
333 ``-z [int]`` Set the number of sections per zone.
336 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
337 ``-t [0 or 1]`` Disable discard command or not.
345 ---------
346 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
347 partition, which examines whether the filesystem metadata and user-made data
348 are cross-referenced correctly or not.
353 -d debug level [default:0]
358 ---------
362 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
363 It shows on-disk inode information recognized by a given inode number, and is
369 -d debug level [default:0]
370 -i inode no (hex)
371 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
372 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
376 # dump.f2fs -i [ino] /dev/sdx
377 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
378 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
383 ----------
390 -----------
391 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
397 -----------
405 -------
407 f2fs-specific ones, which is very useful for QA tests.
414 On-disk Layout
415 --------------
425 align with the zone size <-|
426 |-> align with the segment size
444 - Superblock (SB)
449 - Checkpoint (CP)
453 - Segment Information Table (SIT)
457 - Node Address Table (NAT)
461 - Segment Summary Area (SSA)
465 - Main Area
466 It contains file and directory data including their indices.
468 In order to avoid misalignment between file system and flash-based storage, F2FS
477 ------------------------------
488 +--------+----------+---------+
490 +--------+----------+---------+
494 +-------+-------+--------+--------+--------+--------+
496 +-------+-------+--------+--------+--------+--------+
499 `----------------------------------------'
502 ---------------
515 |- data (923)
516 |- direct node (2)
517 | `- data (1018)
518 |- indirect node (2)
519 | `- direct node (1018)
520 | `- data (1018)
521 `- double indirect node (1)
522 `- indirect node (1018)
523 `- direct node (1018)
524 `- data (1018)
531 Directory Structure
532 -------------------
534 A directory entry occupies 11 bytes, which consists of the following attributes.
536 - hash hash value of the file name
537 - ino inode number
538 - len the length of file name
539 - type file type such as directory, symlink, etc
551 +--------------------------------+
553 +--------------------------------+
557 +--------+----------+----------+------------+
559 +--------+----------+----------+------------+
563 +------+------+-----+------+
565 +------+------+-----+------+
568 F2FS implements multi-level hash tables for directory structure. Each level has
574 ----------------------
578 ----------------------
582 level #1 | A(2B) - A(2B)
584 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
586 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
588 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
592 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
594 `- 4, Otherwise
596 ,- 2^(n + dir_level),
599 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
602 When F2FS finds a file name in a directory, at first a hash value of the file
618 --------------> Dir <--------------
622 child - child [hole] - child
624 child - child - child [hole] - [hole] - child
631 ------------------------
636 - Hot node contains direct node blocks of directories.
637 - Warm node contains direct node blocks except hot node blocks.
638 - Cold node contains indirect node blocks
639 - Hot data contains dentry blocks
640 - Warm data contains data blocks except hot and cold data blocks
641 - Cold data contains multimedia data or migrated data blocks
643 LFS has two schemes for free space management: threaded log and copy-and-compac-
644 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
649 scheme where the copy-and-compaction scheme is adopted by default, but the
653 In order to align F2FS with underlying flash-based storage, F2FS allocates a
661 ----------------
663 F2FS does cleaning both on demand and in the background. On-demand cleaning is
668 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
670 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
673 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
680 Write-hint Policy
681 -----------------
685 2) whint_mode=user-based. F2FS tries to pass down hints given by
698 -- buffered io
706 -- direct io
715 3) whint_mode=fs-based. F2FS passes down hints with its policy.
727 -- buffered io
735 -- direct io
745 -------------------
760 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addressess having
771 --------------------------
773 - New term named cluster is defined as basic unit of compression, file can
778 - In cluster metadata layout, one special block address is used to indicate
780 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
783 - In order to eliminate write amplification during overwrite, F2FS only
784 support compression on write-once file, data can be compressed only when
788 - To enable compression on regular inode, there are three ways:
792 * mount w/ -o compress_extension=ext; touch file.ext
797 +-----------------------------------------------+
799 +-----------------------------------------------+
803 +----------+---------+---------+---------+ +---------+---------+---------+---------+
805 +----------+---------+---------+---------+ +---------+---------+---------+---------+
809 +-------------+-------------+----------+----------------------------+
811 +-------------+-------------+----------+----------------------------+
814 ----------------------------
816 - ZNS defines a per-zone capacity which can be equal or less than the
817 zone-size. Zone-capacity is the number of usable blocks in the zone.
818 F2FS checks if zone-capacity is less than zone-size, if it is, then any
819 segment which starts after the zone-capacity is marked as not-free in
823 zone-capacity is not aligned to default segment size(2MB), then a segment
824 can start before the zone-capacity and span across zone-capacity boundary.
826 past the zone-capacity are considered unusable in these segments.