Lines Matching +full:files +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.
40 files can be read back from the log efficiently. In order to maintain large free
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
136 is not aware of cold files such as media files.
142 files can be written into inode block.
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
218 layer. This supports "off", "user-based", and
219 "fs-based". In "off" mode (default), f2fs does not pass
220 down hints. In "user-based" mode, f2fs tries to pass
221 down hints given by users. And in "fs-based" mode, f2fs
232 based on "posix", but doesn't issue flush command for
233 non-atomic files likewise "nobarrier" mount option.
257 "lz4", "zstd" and "lzo-rle" algorithm.
262 compression on those corresponding files, e.g. if all files
266 For other files, we can still enable compression via ioctl.
268 can be set to enable compression for all files.
270 files using the blk-crypto framework rather than
271 filesystem-layer encryption. This allows the use of
272 inline encryption hardware. The on-disk format is
274 Documentation/block/inline-encryption.rst.
275 atgc Enable age-threshold garbage collection, it provides high
287 - major file system information managed by f2fs currently
288 - average SIT information about whole segments
289 - current memory footprint consumed by f2fs.
296 /sys/fs/f2fs based on its device name (i.e., /sys/fs/f2fs/sda).
297 The files in each per-device directory are shown in table below.
299 Files in /sys/fs/f2fs/<devname>
300 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
318 # mkfs.f2fs -l label /dev/block_device
319 # mount -t f2fs /dev/block_device /mnt/f2fs
322 ---------
324 which builds a basic on-disk layout.
329 ``-l [label]`` Give a volume label, up to 512 unicode name.
330 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
333 ``-o [int]`` Set overprovision ratio in percent over volume size.
336 ``-s [int]`` Set the number of segments per section.
339 ``-z [int]`` Set the number of sections per zone.
342 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
343 ``-t [0 or 1]`` Disable discard command or not.
351 ---------
352 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
353 partition, which examines whether the filesystem metadata and user-made data
354 are cross-referenced correctly or not.
359 -d debug level [default:0]
364 ---------
368 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
369 It shows on-disk inode information recognized by a given inode number, and is
370 able to dump all the SSA and SIT entries into predefined files, ./dump_ssa and
375 -d debug level [default:0]
376 -i inode no (hex)
377 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
378 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
382 # dump.f2fs -i [ino] /dev/sdx
383 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
384 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
389 ----------
390 The sload.f2fs gives a way to insert files and directories in the exisiting disk
391 image. This tool is useful when building f2fs images given compiled files.
396 -----------
397 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
398 all the files and directories stored in the image.
403 -----------
411 -------
413 f2fs-specific ones, which is very useful for QA tests.
420 On-disk Layout
421 --------------
431 align with the zone size <-|
432 |-> align with the segment size
450 - Superblock (SB)
455 - Checkpoint (CP)
459 - Segment Information Table (SIT)
463 - Node Address Table (NAT)
467 - Segment Summary Area (SSA)
471 - Main Area
474 In order to avoid misalignment between file system and flash-based storage, F2FS
483 ------------------------------
494 +--------+----------+---------+
496 +--------+----------+---------+
500 +-------+-------+--------+--------+--------+--------+
502 +-------+-------+--------+--------+--------+--------+
505 `----------------------------------------'
508 ---------------
521 |- data (923)
522 |- direct node (2)
523 | `- data (1018)
524 |- indirect node (2)
525 | `- direct node (1018)
526 | `- data (1018)
527 `- double indirect node (1)
528 `- indirect node (1018)
529 `- direct node (1018)
530 `- data (1018)
538 -------------------
542 - hash hash value of the file name
543 - ino inode number
544 - len the length of file name
545 - type file type such as directory, symlink, etc
557 +--------------------------------+
559 +--------------------------------+
563 +--------+----------+----------+------------+
565 +--------+----------+----------+------------+
569 +------+------+-----+------+
571 +------+------+-----+------+
574 F2FS implements multi-level hash tables for directory structure. Each level has
580 ----------------------
584 ----------------------
588 level #1 | A(2B) - A(2B)
590 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
592 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
594 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
598 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
600 `- 4, Otherwise
602 ,- 2^(n + dir_level),
605 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
613 one bucket determined by the following equation, which shows O(log(# of files))
624 --------------> Dir <--------------
628 child - child [hole] - child
630 child - child - child [hole] - [hole] - child
637 ------------------------
642 - Hot node contains direct node blocks of directories.
643 - Warm node contains direct node blocks except hot node blocks.
644 - Cold node contains indirect node blocks
645 - Hot data contains dentry blocks
646 - Warm data contains data blocks except hot and cold data blocks
647 - Cold data contains multimedia data or migrated data blocks
649 LFS has two schemes for free space management: threaded log and copy-and-compac-
650 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
655 scheme where the copy-and-compaction scheme is adopted by default, but the
659 In order to align F2FS with underlying flash-based storage, F2FS allocates a
667 ----------------
669 F2FS does cleaning both on demand and in the background. On-demand cleaning is
674 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
676 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
679 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
686 Write-hint Policy
687 -----------------
691 2) whint_mode=user-based. F2FS tries to pass down hints given by
704 -- buffered io
712 -- direct io
721 3) whint_mode=fs-based. F2FS passes down hints with its policy.
733 -- buffered io
741 -- direct io
751 -------------------
766 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addressess having
777 --------------------------
779 - New term named cluster is defined as basic unit of compression, file can
784 - In cluster metadata layout, one special block address is used to indicate
786 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
789 - In order to eliminate write amplification during overwrite, F2FS only
790 support compression on write-once file, data can be compressed only when
794 - To enable compression on regular inode, there are three ways:
798 * mount w/ -o compress_extension=ext; touch file.ext
803 +-----------------------------------------------+
805 +-----------------------------------------------+
809 +----------+---------+---------+---------+ +---------+---------+---------+---------+
811 +----------+---------+---------+---------+ +---------+---------+---------+---------+
815 +-------------+-------------+----------+----------------------------+
817 +-------------+-------------+----------+----------------------------+
820 ----------------------------
822 - ZNS defines a per-zone capacity which can be equal or less than the
823 zone-size. Zone-capacity is the number of usable blocks in the zone.
824 F2FS checks if zone-capacity is less than zone-size, if it is, then any
825 segment which starts after the zone-capacity is marked as not-free in
829 zone-capacity is not aligned to default segment size(2MB), then a segment
830 can start before the zone-capacity and span across zone-capacity boundary.
832 past the zone-capacity are considered unusable in these segments.