2019-05-19 12:07:45 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2012-11-02 08:25:27 +00:00
|
|
|
config F2FS_FS
|
2015-03-04 01:06:55 +00:00
|
|
|
tristate "F2FS filesystem support"
|
2012-11-30 08:32:08 +00:00
|
|
|
depends on BLOCK
|
2019-08-08 02:02:53 +00:00
|
|
|
select NLS
|
2016-03-02 20:04:24 +00:00
|
|
|
select CRYPTO
|
|
|
|
select CRYPTO_CRC32
|
2018-12-12 09:50:12 +00:00
|
|
|
select F2FS_FS_XATTR if FS_ENCRYPTION
|
2019-12-27 02:47:00 +00:00
|
|
|
select FS_ENCRYPTION_ALGS if FS_ENCRYPTION
|
f2fs: compress: Allow modular (de)compression algorithms
If F2FS_FS is modular, enabling the compressions options
F2FS_FS_{LZ4,LZ4HZ,LZO,LZORLE,ZSTD} will make the (de)compression
algorithms {LZ4,LZ4HC,LZO,ZSTD}_{,DE}COMPRESS builtin instead of
modular, as the former depend on an intermediate boolean
F2FS_FS_COMPRESSION, which in-turn depends on tristate F2FS_FS.
Indeed, if a boolean symbol A depends directly on a tristate symbol B
and selects another tristate symbol C:
tristate B
tristate C
bool A
depends on B
select C
and B is modular, then C will also be modular.
However, if there is an intermediate boolean D in the dependency chain
between A and B:
tristate B
tristate C
bool D
depends on B
bool A
depends on D
select C
then the modular state won't propagate from B to C, and C will be
builtin instead of modular.
As modular dependency propagation through intermediate symbols is
obscure, fix this in a robust way by moving the selection of tristate
(de)compression algorithms from the boolean compression options to the
tristate main F2FS_FS option.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-02-26 15:51:42 +00:00
|
|
|
select LZ4_COMPRESS if F2FS_FS_LZ4
|
|
|
|
select LZ4_DECOMPRESS if F2FS_FS_LZ4
|
|
|
|
select LZ4HC_COMPRESS if F2FS_FS_LZ4HC
|
|
|
|
select LZO_COMPRESS if F2FS_FS_LZO
|
|
|
|
select LZO_DECOMPRESS if F2FS_FS_LZO
|
|
|
|
select ZSTD_COMPRESS if F2FS_FS_ZSTD
|
|
|
|
select ZSTD_DECOMPRESS if F2FS_FS_ZSTD
|
2012-11-02 08:25:27 +00:00
|
|
|
help
|
|
|
|
F2FS is based on Log-structured File System (LFS), which supports
|
|
|
|
versatile "flash-friendly" features. The design has been focused on
|
|
|
|
addressing the fundamental issues in LFS, which are snowball effect
|
|
|
|
of wandering tree and high cleaning overhead.
|
|
|
|
|
|
|
|
Since flash-based storages show different characteristics according to
|
|
|
|
the internal geometry or flash memory management schemes aka FTL, F2FS
|
|
|
|
and tools support various parameters not only for configuring on-disk
|
|
|
|
layout, but also for selecting allocation and cleaning algorithms.
|
|
|
|
|
|
|
|
If unsure, say N.
|
|
|
|
|
|
|
|
config F2FS_STAT_FS
|
|
|
|
bool "F2FS Status Information"
|
2020-01-22 18:51:16 +00:00
|
|
|
depends on F2FS_FS
|
2012-11-02 08:25:27 +00:00
|
|
|
default y
|
|
|
|
help
|
|
|
|
/sys/kernel/debug/f2fs/ contains information about all the partitions
|
|
|
|
mounted as f2fs. Each file shows the whole f2fs information.
|
|
|
|
|
|
|
|
/sys/kernel/debug/f2fs/status includes:
|
2014-08-06 14:22:50 +00:00
|
|
|
- major filesystem information managed by f2fs currently
|
2012-11-02 08:25:27 +00:00
|
|
|
- average SIT information about whole segments
|
|
|
|
- current memory footprint consumed by f2fs.
|
|
|
|
|
|
|
|
config F2FS_FS_XATTR
|
|
|
|
bool "F2FS extended attributes"
|
|
|
|
depends on F2FS_FS
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Extended attributes are name:value pairs associated with inodes by
|
2017-12-20 13:58:52 +00:00
|
|
|
the kernel or by users (see the attr(5) manual page for details).
|
2012-11-02 08:25:27 +00:00
|
|
|
|
|
|
|
If unsure, say N.
|
|
|
|
|
|
|
|
config F2FS_FS_POSIX_ACL
|
|
|
|
bool "F2FS Access Control Lists"
|
|
|
|
depends on F2FS_FS_XATTR
|
|
|
|
select FS_POSIX_ACL
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Posix Access Control Lists (ACLs) support permissions for users and
|
2015-08-18 13:42:15 +00:00
|
|
|
groups beyond the owner/group/world scheme.
|
2012-11-02 08:25:27 +00:00
|
|
|
|
|
|
|
If you don't know what Access Control Lists are, say N
|
2013-06-03 10:46:19 +00:00
|
|
|
|
|
|
|
config F2FS_FS_SECURITY
|
|
|
|
bool "F2FS Security Labels"
|
|
|
|
depends on F2FS_FS_XATTR
|
|
|
|
help
|
|
|
|
Security labels provide an access control facility to support Linux
|
|
|
|
Security Models (LSMs) accepted by AppArmor, SELinux, Smack and TOMOYO
|
|
|
|
Linux. This option enables an extended attribute handler for file
|
|
|
|
security labels in the f2fs filesystem, so that it requires enabling
|
2019-08-25 09:28:38 +00:00
|
|
|
the extended attribute support in advance. In particular you need this
|
|
|
|
option if you use the setcap command to assign initial process capabi-
|
|
|
|
lities to executables (the security.* extended attributes).
|
2013-06-03 10:46:19 +00:00
|
|
|
|
|
|
|
If you are not using a security module, say N.
|
2013-10-29 06:43:01 +00:00
|
|
|
|
|
|
|
config F2FS_CHECK_FS
|
|
|
|
bool "F2FS consistency checking feature"
|
|
|
|
depends on F2FS_FS
|
|
|
|
help
|
2014-08-06 14:22:50 +00:00
|
|
|
Enables BUG_ONs which check the filesystem consistency in runtime.
|
2013-10-29 06:43:01 +00:00
|
|
|
|
|
|
|
If you want to improve the performance, say N.
|
2014-12-18 03:45:05 +00:00
|
|
|
|
2016-04-29 22:34:32 +00:00
|
|
|
config F2FS_FAULT_INJECTION
|
|
|
|
bool "F2FS fault injection facility"
|
|
|
|
depends on F2FS_FS
|
|
|
|
help
|
|
|
|
Test F2FS to inject faults such as ENOMEM, ENOSPC, and so on.
|
|
|
|
|
|
|
|
If unsure, say N.
|
f2fs: support data compression
This patch tries to support compression in f2fs.
- New term named cluster is defined as basic unit of compression, file can
be divided into multiple clusters logically. One cluster includes 4 << n
(n >= 0) logical pages, compression size is also cluster size, each of
cluster can be compressed or not.
- In cluster metadata layout, one special flag is used to indicate cluster
is compressed one or normal one, for compressed cluster, following metadata
maps cluster to [1, 4 << n - 1] physical blocks, in where f2fs stores
data including compress header and compressed data.
- In order to eliminate write amplification during overwrite, F2FS only
support compression on write-once file, data can be compressed only when
all logical blocks in file are valid and cluster compress ratio is lower
than specified threshold.
- To enable compression on regular inode, there are three ways:
* chattr +c file
* chattr +c dir; touch dir/file
* mount w/ -o compress_extension=ext; touch file.ext
Compress metadata layout:
[Dnode Structure]
+-----------------------------------------------+
| cluster 1 | cluster 2 | ......... | cluster N |
+-----------------------------------------------+
. . . .
. . . .
. Compressed Cluster . . Normal Cluster .
+----------+---------+---------+---------+ +---------+---------+---------+---------+
|compr flag| block 1 | block 2 | block 3 | | block 1 | block 2 | block 3 | block 4 |
+----------+---------+---------+---------+ +---------+---------+---------+---------+
. .
. .
. .
+-------------+-------------+----------+----------------------------+
| data length | data chksum | reserved | compressed data |
+-------------+-------------+----------+----------------------------+
Changelog:
20190326:
- fix error handling of read_end_io().
- remove unneeded comments in f2fs_encrypt_one_page().
20190327:
- fix wrong use of f2fs_cluster_is_full() in f2fs_mpage_readpages().
- don't jump into loop directly to avoid uninitialized variables.
- add TODO tag in error path of f2fs_write_cache_pages().
20190328:
- fix wrong merge condition in f2fs_read_multi_pages().
- check compressed file in f2fs_post_read_required().
20190401
- allow overwrite on non-compressed cluster.
- check cluster meta before writing compressed data.
20190402
- don't preallocate blocks for compressed file.
- add lz4 compress algorithm
- process multiple post read works in one workqueue
Now f2fs supports processing post read work in multiple workqueue,
it shows low performance due to schedule overhead of multiple
workqueue executing orderly.
20190921
- compress: support buffered overwrite
C: compress cluster flag
V: valid block address
N: NEW_ADDR
One cluster contain 4 blocks
before overwrite after overwrite
- VVVV -> CVNN
- CVNN -> VVVV
- CVNN -> CVNN
- CVNN -> CVVV
- CVVV -> CVNN
- CVVV -> CVVV
20191029
- add kconfig F2FS_FS_COMPRESSION to isolate compression related
codes, add kconfig F2FS_FS_{LZO,LZ4} to cover backend algorithm.
note that: will remove lzo backend if Jaegeuk agreed that too.
- update codes according to Eric's comments.
20191101
- apply fixes from Jaegeuk
20191113
- apply fixes from Jaegeuk
- split workqueue for fsverity
20191216
- apply fixes from Jaegeuk
20200117
- fix to avoid NULL pointer dereference
[Jaegeuk Kim]
- add tracepoint for f2fs_{,de}compress_pages()
- fix many bugs and add some compression stats
- fix overwrite/mmap bugs
- address 32bit build error, reported by Geert.
- bug fixes when handling errors and i_compressed_blocks
Reported-by: <noreply@ellerman.id.au>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2019-11-01 10:07:14 +00:00
|
|
|
|
|
|
|
config F2FS_FS_COMPRESSION
|
|
|
|
bool "F2FS compression feature"
|
|
|
|
depends on F2FS_FS
|
|
|
|
help
|
|
|
|
Enable filesystem-level compression on f2fs regular files,
|
|
|
|
multiple back-end compression algorithms are supported.
|
|
|
|
|
|
|
|
config F2FS_FS_LZO
|
|
|
|
bool "LZO compression support"
|
|
|
|
depends on F2FS_FS_COMPRESSION
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Support LZO compress algorithm, if unsure, say Y.
|
|
|
|
|
|
|
|
config F2FS_FS_LZ4
|
|
|
|
bool "LZ4 compression support"
|
|
|
|
depends on F2FS_FS_COMPRESSION
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Support LZ4 compress algorithm, if unsure, say Y.
|
2020-03-03 09:46:02 +00:00
|
|
|
|
2021-01-22 09:46:43 +00:00
|
|
|
config F2FS_FS_LZ4HC
|
|
|
|
bool "LZ4HC compression support"
|
|
|
|
depends on F2FS_FS_COMPRESSION
|
|
|
|
depends on F2FS_FS_LZ4
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Support LZ4HC compress algorithm, LZ4HC has compatible on-disk
|
|
|
|
layout with LZ4, if unsure, say Y.
|
|
|
|
|
2020-03-03 09:46:02 +00:00
|
|
|
config F2FS_FS_ZSTD
|
|
|
|
bool "ZSTD compression support"
|
|
|
|
depends on F2FS_FS_COMPRESSION
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Support ZSTD compress algorithm, if unsure, say Y.
|
2020-04-08 11:56:32 +00:00
|
|
|
|
|
|
|
config F2FS_FS_LZORLE
|
|
|
|
bool "LZO-RLE compression support"
|
|
|
|
depends on F2FS_FS_COMPRESSION
|
|
|
|
depends on F2FS_FS_LZO
|
|
|
|
default y
|
|
|
|
help
|
|
|
|
Support LZO-RLE compress algorithm, if unsure, say Y.
|