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
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
144 directory entries can be written into inode block. The
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
211 prjjquota=<file> <quota file>: must be in root directory;
219 layer. This supports "off", "user-based", and
220 "fs-based". In "off" mode (default), f2fs does not pass
221 down hints. In "user-based" mode, f2fs tries to pass
222 down hints given by users. And in "fs-based" mode, f2fs
233 based on "posix", but doesn't issue flush command for
234 non-atomic files likewise "nobarrier" mount option.
269 "lz4", "zstd" and "lzo-rle" algorithm.
273 lz4 3 - 16
274 zstd 1 - 22
310 files using the blk-crypto framework rather than
311 filesystem-layer encryption. This allows the use of
312 inline encryption hardware. The on-disk format is
314 Documentation/block/inline-encryption.rst.
315 atgc Enable age-threshold garbage collection, it provides high
335 - major file system information managed by f2fs currently
336 - average SIT information about whole segments
337 - current memory footprint consumed by f2fs.
343 /sys/fs/f2fs. Each mounted filesystem will have a directory in
344 /sys/fs/f2fs based on its device name (i.e., /sys/fs/f2fs/sda).
345 The files in each per-device directory are shown in table below.
348 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
360 3. Create a directory to use when mounting::
366 # mkfs.f2fs -l label /dev/block_device
367 # mount -t f2fs /dev/block_device /mnt/f2fs
370 ---------
372 which builds a basic on-disk layout.
377 ``-l [label]`` Give a volume label, up to 512 unicode name.
378 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
381 ``-o [int]`` Set overprovision ratio in percent over volume size.
384 ``-s [int]`` Set the number of segments per section.
387 ``-z [int]`` Set the number of sections per zone.
390 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
391 ``-t [0 or 1]`` Disable discard command or not.
399 ---------
400 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
401 partition, which examines whether the filesystem metadata and user-made data
402 are cross-referenced correctly or not.
407 -d debug level [default:0]
412 ---------
416 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
417 It shows on-disk inode information recognized by a given inode number, and is
423 -d debug level [default:0]
424 -i inode no (hex)
425 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
426 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
430 # dump.f2fs -i [ino] /dev/sdx
431 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
432 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
437 ----------
444 -----------
445 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
451 -----------
459 -------
461 f2fs-specific ones, which is very useful for QA tests.
468 On-disk Layout
469 --------------
479 align with the zone size <-|
480 |-> align with the segment size
498 - Superblock (SB)
503 - Checkpoint (CP)
507 - Segment Information Table (SIT)
511 - Node Address Table (NAT)
515 - Segment Summary Area (SSA)
519 - Main Area
520 It contains file and directory data including their indices.
522 In order to avoid misalignment between file system and flash-based storage, F2FS
531 ------------------------------
542 +--------+----------+---------+
544 +--------+----------+---------+
548 +-------+-------+--------+--------+--------+--------+
550 +-------+-------+--------+--------+--------+--------+
553 `----------------------------------------'
556 ---------------
569 |- data (923)
570 |- direct node (2)
571 | `- data (1018)
572 |- indirect node (2)
573 | `- direct node (1018)
574 | `- data (1018)
575 `- double indirect node (1)
576 `- indirect node (1018)
577 `- direct node (1018)
578 `- data (1018)
585 Directory Structure
586 -------------------
588 A directory entry occupies 11 bytes, which consists of the following attributes.
590 - hash hash value of the file name
591 - ino inode number
592 - len the length of file name
593 - type file type such as directory, symlink, etc
605 +--------------------------------+
607 +--------------------------------+
611 +--------+----------+----------+------------+
613 +--------+----------+----------+------------+
617 +------+------+-----+------+
619 +------+------+-----+------+
622 F2FS implements multi-level hash tables for directory structure. Each level has
628 ----------------------
632 ----------------------
636 level #1 | A(2B) - A(2B)
638 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
640 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
642 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
646 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
648 `- 4, Otherwise
650 ,- 2^(n + dir_level),
653 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
656 When F2FS finds a file name in a directory, at first a hash value of the file
672 --------------> Dir <--------------
676 child - child [hole] - child
678 child - child - child [hole] - [hole] - child
685 ------------------------
690 - Hot node contains direct node blocks of directories.
691 - Warm node contains direct node blocks except hot node blocks.
692 - Cold node contains indirect node blocks
693 - Hot data contains dentry blocks
694 - Warm data contains data blocks except hot and cold data blocks
695 - Cold data contains multimedia data or migrated data blocks
697 LFS has two schemes for free space management: threaded log and copy-and-compac-
698 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
703 scheme where the copy-and-compaction scheme is adopted by default, but the
707 In order to align F2FS with underlying flash-based storage, F2FS allocates a
715 ----------------
717 F2FS does cleaning both on demand and in the background. On-demand cleaning is
722 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
724 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
727 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
734 Write-hint Policy
735 -----------------
739 2) whint_mode=user-based. F2FS tries to pass down hints given by
752 -- buffered io
760 -- direct io
769 3) whint_mode=fs-based. F2FS passes down hints with its policy.
781 -- buffered io
789 -- direct io
799 -------------------
814 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addressess having
825 --------------------------
827 - New term named cluster is defined as basic unit of compression, file can
832 - In cluster metadata layout, one special block address is used to indicate
834 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
837 - In order to eliminate write amplification during overwrite, F2FS only
838 support compression on write-once file, data can be compressed only when
842 - To enable compression on regular inode, there are four ways:
846 * mount w/ -o compress_extension=ext; touch file.ext
847 * mount w/ -o compress_extension=*; touch any_file
849 - To disable compression on regular inode, there are two ways:
851 * chattr -c file
852 * mount w/ -o nocompress_extension=ext; touch file.ext
854 - Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
858 should be compresse, bar.zip should be non-compressed. chattr +c dir/bar.zip
860 * compress_extension=so; nocompress_extension=zip; chattr -c dir; touch
862 compresse, bar.zip and baz.txt should be non-compressed.
866 - At this point, compression feature doesn't expose compressed space to user
879 +-----------------------------------------------+
881 +-----------------------------------------------+
885 +----------+---------+---------+---------+ +---------+---------+---------+---------+
887 +----------+---------+---------+---------+ +---------+---------+---------+---------+
891 +-------------+-------------+----------+----------------------------+
893 +-------------+-------------+----------+----------------------------+
896 --------------------------
924 ----------------------------
926 - ZNS defines a per-zone capacity which can be equal or less than the
927 zone-size. Zone-capacity is the number of usable blocks in the zone.
928 F2FS checks if zone-capacity is less than zone-size, if it is, then any
929 segment which starts after the zone-capacity is marked as not-free in
933 zone-capacity is not aligned to default segment size(2MB), then a segment
934 can start before the zone-capacity and span across zone-capacity boundary.
936 past the zone-capacity are considered unusable in these segments.