Lines Matching +full:download +full:- +full:git +full:- +full:cache

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
23 The following git tree provides the file system formatting tool (mkfs.f2fs),
26 - git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git
30 - linux-f2fs-devel@lists.sourceforge.net
34 - https://bugzilla.kernel.org/enter_bug.cgi?product=File%20System&component=f2fs
39 Log-structured File System (LFS)
40 --------------------------------
41 "A log-structured file system writes all modifications to disk sequentially in
42 a log-like structure, thereby speeding up both file writing and crash recovery.
48 implementation of a log-structured file system", ACM Trans. Computer Systems
52 ----------------------
61 [1] Bityutskiy, A. 2005. JFFS3 design issues. http://www.linux-mtd.infradead.org/
64 -----------------
65 Since LFS is based on out-of-place writes, it produces so many obsolete blocks
75 3. It checks the cross-reference between the data and its parent index structure.
86 ---------------
87 - Enlarge the random write area for better performance, but provide the high
89 - Align FS data structures to the operational units in FTL as best efforts
92 ----------------------
93 - Use a term, “node”, that represents inodes as well as various pointer blocks
94 - Introduce Node Address Table (NAT) containing the locations of all the “node”
98 -----------------
99 - Support a background cleaning process
100 - Support greedy and cost-benefit algorithms for victim selection policies
101 - Support multi-head logs for static/dynamic hot and cold data separation
102 - Introduce adaptive logging for efficient block allocation
123 disable_roll_forward Disable the roll-forward recovery routine
124 norecovery Disable the roll-forward recovery routine, mounted read-
125 only (i.e., -o ro,disable_roll_forward)
126 discard/nodiscard Enable/disable real-time discard in f2fs, if discard is
164 extent_cache Enable an extent cache based on rb-tree, it can cache
167 increasing the cache hit ratio. Set by default.
168 noextent_cache Disable an extent cache based on rb-tree explicitly, see
216 fragmentation/after-GC situation itself. The developers use these
217 modes to understand filesystem fragmentation/after-GC condition well,
220 position. With this, we can simulate the after-GC condition.
231 recommend to re-format the filesystem after using these options.
254 non-atomic files likewise "nobarrier" mount option.
289 "lz4", "zstd" and "lzo-rle" algorithm.
293 lz4 3 - 16
294 zstd 1 - 22
326 cache compressed block, in order to improve cache hit ratio of
329 files using the blk-crypto framework rather than
330 filesystem-layer encryption. This allows the use of
331 inline encryption hardware. The on-disk format is
333 Documentation/block/inline-encryption.rst.
334 atgc Enable age-threshold garbage collection, it provides high
349 age_extent_cache Enable an age extent cache based on rb-tree. It records
354 "panic", "continue" and "remount-ro", respectively, trigger
356 the partition in read-only mode. By default it uses "continue"
359 mode continue remount-ro panic
362 syscall errors -EIO -EROFS N/A
365 pending non-dir write drop keep N/A
381 - major file system information managed by f2fs currently
382 - average SIT information about whole segments
383 - current memory footprint consumed by f2fs.
391 The files in each per-device directory are shown in table below.
394 (see also Documentation/ABI/testing/sysfs-fs-f2fs)
399 1. Download userland tools and compile them.
412 # mkfs.f2fs -l label /dev/block_device
413 # mount -t f2fs /dev/block_device /mnt/f2fs
416 ---------
418 which builds a basic on-disk layout.
423 ``-l [label]`` Give a volume label, up to 512 unicode name.
424 ``-a [0 or 1]`` Split start location of each area for heap-based allocation.
427 ``-o [int]`` Set overprovision ratio in percent over volume size.
430 ``-s [int]`` Set the number of segments per section.
433 ``-z [int]`` Set the number of sections per zone.
436 ``-e [str]`` Set basic extension list. e.g. "mp3,gif,mov"
437 ``-t [0 or 1]`` Disable discard command or not.
445 ---------
446 The fsck.f2fs is a tool to check the consistency of an f2fs-formatted
447 partition, which examines whether the filesystem metadata and user-made data
448 are cross-referenced correctly or not.
453 -d debug level [default:0]
458 ---------
462 The dump.f2fs is used to debug on-disk data structures of the f2fs filesystem.
463 It shows on-disk inode information recognized by a given inode number, and is
469 -d debug level [default:0]
470 -i inode no (hex)
471 -s [SIT dump segno from #1~#2 (decimal), for all 0~-1]
472 -a [SSA dump segno from #1~#2 (decimal), for all 0~-1]
476 # dump.f2fs -i [ino] /dev/sdx
477 # dump.f2fs -s 0~-1 /dev/sdx (SIT dump)
478 # dump.f2fs -a 0~-1 /dev/sdx (SSA dump)
483 ----------
490 -----------
491 The resize.f2fs lets a user resize the f2fs-formatted disk image, while preserving
497 -----------
505 -------
507 f2fs-specific ones, which is very useful for QA tests.
514 On-disk Layout
515 --------------
525 align with the zone size <-|
526 |-> align with the segment size
544 - Superblock (SB)
549 - Checkpoint (CP)
553 - Segment Information Table (SIT)
557 - Node Address Table (NAT)
561 - Segment Summary Area (SSA)
565 - Main Area
568 In order to avoid misalignment between file system and flash-based storage, F2FS
577 ------------------------------
588 +--------+----------+---------+
590 +--------+----------+---------+
594 +-------+-------+--------+--------+--------+--------+
596 +-------+-------+--------+--------+--------+--------+
599 `----------------------------------------'
602 ---------------
615 |- data (923)
616 |- direct node (2)
617 | `- data (1018)
618 |- indirect node (2)
619 | `- direct node (1018)
620 | `- data (1018)
621 `- double indirect node (1)
622 `- indirect node (1018)
623 `- direct node (1018)
624 `- data (1018)
632 -------------------
636 - hash hash value of the file name
637 - ino inode number
638 - len the length of file name
639 - type file type such as directory, symlink, etc
651 +--------------------------------+
653 +--------------------------------+
657 +--------+----------+----------+------------+
659 +--------+----------+----------+------------+
663 +------+------+-----+------+
665 +------+------+-----+------+
668 F2FS implements multi-level hash tables for directory structure. Each level has
674 ----------------------
678 ----------------------
682 level #1 | A(2B) - A(2B)
684 level #2 | A(2B) - A(2B) - A(2B) - A(2B)
686 level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
688 level #N | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)
692 ,- 2, if n < MAX_DIR_HASH_DEPTH / 2,
694 `- 4, Otherwise
696 ,- 2^(n + dir_level),
699 `- 2^((MAX_DIR_HASH_DEPTH / 2) - 1),
718 --------------> Dir <--------------
722 child - child [hole] - child
724 child - child - child [hole] - [hole] - child
731 ------------------------
736 - Hot node contains direct node blocks of directories.
737 - Warm node contains direct node blocks except hot node blocks.
738 - Cold node contains indirect node blocks
739 - Hot data contains dentry blocks
740 - Warm data contains data blocks except hot and cold data blocks
741 - Cold data contains multimedia data or migrated data blocks
743 LFS has two schemes for free space management: threaded log and copy-and-compac-
744 tion. The copy-and-compaction scheme which is known as cleaning, is well-suited
749 scheme where the copy-and-compaction scheme is adopted by default, but the
753 In order to align F2FS with underlying flash-based storage, F2FS allocates a
761 ----------------
763 F2FS does cleaning both on demand and in the background. On-demand cleaning is
768 F2FS supports two victim selection policies: greedy and cost-benefit algorithms.
770 of valid blocks. In the cost-benefit algorithm, F2FS selects a victim segment
773 algorithm for on-demand cleaner, while background cleaner adopts cost-benefit
780 Write-hint Policy
781 -----------------
795 -- buffered io
800 -- direct io
810 -------------------
825 fallocate(fd, DEFAULT_MODE), it allocates on-disk block addresses having
836 --------------------------
838 - New term named cluster is defined as basic unit of compression, file can
843 - In cluster metadata layout, one special block address is used to indicate
845 metadata maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs
848 - In order to eliminate write amplification during overwrite, F2FS only
849 support compression on write-once file, data can be compressed only when
853 - To enable compression on regular inode, there are four ways:
857 * mount w/ -o compress_extension=ext; touch file.ext
858 * mount w/ -o compress_extension=*; touch any_file
860 - To disable compression on regular inode, there are two ways:
862 * chattr -c file
863 * mount w/ -o nocompress_extension=ext; touch file.ext
865 - Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
869 should be compresse, bar.zip should be non-compressed. chattr +c dir/bar.zip
871 * compress_extension=so; nocompress_extension=zip; chattr -c dir; touch
873 compresse, bar.zip and baz.txt should be non-compressed.
877 - At this point, compression feature doesn't expose compressed space to user
891 +-----------------------------------------------+
893 +-----------------------------------------------+
897 +----------+---------+---------+---------+ +---------+---------+---------+---------+
899 +----------+---------+---------+---------+ +---------+---------+---------+---------+
903 +-------------+-------------+----------+----------------------------+
905 +-------------+-------------+----------+----------------------------+
908 --------------------------
936 ----------------------------
938 - ZNS defines a per-zone capacity which can be equal or less than the
939 zone-size. Zone-capacity is the number of usable blocks in the zone.
940 F2FS checks if zone-capacity is less than zone-size, if it is, then any
941 segment which starts after the zone-capacity is marked as not-free in
945 zone-capacity is not aligned to default segment size(2MB), then a segment
946 can start before the zone-capacity and span across zone-capacity boundary.
948 past the zone-capacity are considered unusable in these segments.
951 -----------------------
963 <use-case>
968 # mkfs.f2fs -c /dev/vdc@vdc.file /dev/vdb
970 # ls -l /mnt/f2fs
972 # df -h
975 # mount -o loop /dev/vdc /mnt/ext4
976 # df -h
987 # df -h