2018-04-04 01:23:33 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
2009-01-22 15:27:30 +08:00
|
|
|
config BTRFS_FS
|
2013-03-19 19:50:59 +08:00
|
|
|
tristate "Btrfs filesystem support"
|
btrfs: Remove custom crc32c init code
The custom crc32 init code was introduced in
14a958e678cd ("Btrfs: fix btrfs boot when compiled as built-in") to
enable using btrfs as a built-in. However, later as pointed out by
60efa5eb2e88 ("Btrfs: use late_initcall instead of module_init") this
wasn't enough and finally btrfs was switched to late_initcall which
comes after the generic crc32c implementation is initiliased. The
latter commit superseeded the former. Now that we don't have to
maintain our own code let's just remove it and switch to using the
generic implementation.
Despite touching a lot of files the patch is really simple. Here is the gist of
the changes:
1. Select LIBCRC32C rather than the low-level modules.
2. s/btrfs_crc32c/crc32c/g
3. replace hash.h with linux/crc32c.h
4. Move the btrfs namehash funcs to ctree.h and change the tree accordingly.
I've tested this with btrfs being both a module and a built-in and xfstest
doesn't complain.
Does seem to fix the longstanding problem of not automatically selectiong
the crc32c module when btrfs is used. Possibly there is a workaround in
dracut.
The modinfo confirms that now all the module dependencies are there:
before:
depends: zstd_compress,zstd_decompress,raid6_pq,xor,zlib_deflate
after:
depends: libcrc32c,zstd_compress,zstd_decompress,raid6_pq,xor,zlib_deflate
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ add more info to changelog from mails ]
Signed-off-by: David Sterba <dsterba@suse.com>
2018-01-08 17:45:05 +08:00
|
|
|
select LIBCRC32C
|
2009-01-22 15:27:30 +08:00
|
|
|
select ZLIB_INFLATE
|
|
|
|
select ZLIB_DEFLATE
|
2010-10-25 15:12:26 +08:00
|
|
|
select LZO_COMPRESS
|
|
|
|
select LZO_DECOMPRESS
|
btrfs: Add zstd support
Add zstd compression and decompression support to BtrFS. zstd at its
fastest level compresses almost as well as zlib, while offering much
faster compression and decompression, approaching lzo speeds.
I benchmarked btrfs with zstd compression against no compression, lzo
compression, and zlib compression. I benchmarked two scenarios. Copying
a set of files to btrfs, and then reading the files. Copying a tarball
to btrfs, extracting it to btrfs, and then reading the extracted files.
After every operation, I call `sync` and include the sync time.
Between every pair of operations I unmount and remount the filesystem
to avoid caching. The benchmark files can be found in the upstream
zstd source repository under
`contrib/linux-kernel/{btrfs-benchmark.sh,btrfs-extract-benchmark.sh}`
[1] [2].
I ran the benchmarks on a Ubuntu 14.04 VM with 2 cores and 4 GiB of RAM.
The VM is running on a MacBook Pro with a 3.1 GHz Intel Core i7 processor,
16 GB of RAM, and a SSD.
The first compression benchmark is copying 10 copies of the unzipped
Silesia corpus [3] into a BtrFS filesystem mounted with
`-o compress-force=Method`. The decompression benchmark times how long
it takes to `tar` all 10 copies into `/dev/null`. The compression ratio is
measured by comparing the output of `df` and `du`. See the benchmark file
[1] for details. I benchmarked multiple zstd compression levels, although
the patch uses zstd level 1.
| Method | Ratio | Compression MB/s | Decompression speed |
|---------|-------|------------------|---------------------|
| None | 0.99 | 504 | 686 |
| lzo | 1.66 | 398 | 442 |
| zlib | 2.58 | 65 | 241 |
| zstd 1 | 2.57 | 260 | 383 |
| zstd 3 | 2.71 | 174 | 408 |
| zstd 6 | 2.87 | 70 | 398 |
| zstd 9 | 2.92 | 43 | 406 |
| zstd 12 | 2.93 | 21 | 408 |
| zstd 15 | 3.01 | 11 | 354 |
The next benchmark first copies `linux-4.11.6.tar` [4] to btrfs. Then it
measures the compression ratio, extracts the tar, and deletes the tar.
Then it measures the compression ratio again, and `tar`s the extracted
files into `/dev/null`. See the benchmark file [2] for details.
| Method | Tar Ratio | Extract Ratio | Copy (s) | Extract (s)| Read (s) |
|--------|-----------|---------------|----------|------------|----------|
| None | 0.97 | 0.78 | 0.981 | 5.501 | 8.807 |
| lzo | 2.06 | 1.38 | 1.631 | 8.458 | 8.585 |
| zlib | 3.40 | 1.86 | 7.750 | 21.544 | 11.744 |
| zstd 1 | 3.57 | 1.85 | 2.579 | 11.479 | 9.389 |
[1] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/btrfs-benchmark.sh
[2] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/btrfs-extract-benchmark.sh
[3] http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia
[4] https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.11.6.tar.xz
zstd source repository: https://github.com/facebook/zstd
Signed-off-by: Nick Terrell <terrelln@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
2017-08-10 10:39:02 +08:00
|
|
|
select ZSTD_COMPRESS
|
|
|
|
select ZSTD_DECOMPRESS
|
2013-01-30 07:40:14 +08:00
|
|
|
select RAID6_PQ
|
2013-02-05 22:38:53 +08:00
|
|
|
select XOR_BLOCKS
|
2014-12-06 00:24:45 +08:00
|
|
|
select SRCU
|
2013-01-30 07:40:14 +08:00
|
|
|
|
2009-01-22 15:27:30 +08:00
|
|
|
help
|
2013-11-20 21:32:34 +08:00
|
|
|
Btrfs is a general purpose copy-on-write filesystem with extents,
|
|
|
|
writable snapshotting, support for multiple devices and many more
|
|
|
|
features focused on fault tolerance, repair and easy administration.
|
2009-01-22 15:27:30 +08:00
|
|
|
|
2013-11-20 21:32:34 +08:00
|
|
|
The filesystem disk format is no longer unstable, and it's not
|
|
|
|
expected to change unless there are strong reasons to do so. If there
|
|
|
|
is a format change, file systems with a unchanged format will
|
|
|
|
continue to be mountable and usable by newer kernels.
|
|
|
|
|
|
|
|
For more information, please see the web pages at
|
|
|
|
http://btrfs.wiki.kernel.org.
|
2009-01-22 15:27:30 +08:00
|
|
|
|
|
|
|
To compile this file system support as a module, choose M here. The
|
|
|
|
module will be called btrfs.
|
|
|
|
|
|
|
|
If unsure, say N.
|
2009-02-04 22:28:28 +08:00
|
|
|
|
|
|
|
config BTRFS_FS_POSIX_ACL
|
|
|
|
bool "Btrfs POSIX Access Control Lists"
|
|
|
|
depends on BTRFS_FS
|
|
|
|
select FS_POSIX_ACL
|
|
|
|
help
|
|
|
|
POSIX Access Control Lists (ACLs) support permissions for users and
|
|
|
|
groups beyond the owner/group/world scheme.
|
|
|
|
|
|
|
|
If you don't know what Access Control Lists are, say N
|
2011-11-02 00:06:04 +08:00
|
|
|
|
|
|
|
config BTRFS_FS_CHECK_INTEGRITY
|
|
|
|
bool "Btrfs with integrity check tool compiled in (DANGEROUS)"
|
|
|
|
depends on BTRFS_FS
|
|
|
|
help
|
|
|
|
Adds code that examines all block write requests (including
|
|
|
|
writes of the super block). The goal is to verify that the
|
|
|
|
state of the filesystem on disk is always consistent, i.e.,
|
|
|
|
after a power-loss or kernel panic event the filesystem is
|
|
|
|
in a consistent state.
|
|
|
|
|
|
|
|
If the integrity check tool is included and activated in
|
|
|
|
the mount options, plenty of kernel memory is used, and
|
|
|
|
plenty of additional CPU cycles are spent. Enabling this
|
|
|
|
functionality is not intended for normal use.
|
|
|
|
|
|
|
|
In most cases, unless you are a btrfs developer who needs
|
|
|
|
to verify the integrity of (super)-block write requests
|
|
|
|
during the run of a regression test, say N
|
2013-03-15 21:47:08 +08:00
|
|
|
|
|
|
|
config BTRFS_FS_RUN_SANITY_TESTS
|
|
|
|
bool "Btrfs will run sanity tests upon loading"
|
|
|
|
depends on BTRFS_FS
|
|
|
|
help
|
|
|
|
This will run some basic sanity tests on the free space cache
|
|
|
|
code to make sure it is acting as it should. These are mostly
|
2013-08-14 17:59:45 +08:00
|
|
|
regression tests and are only really interesting to btrfs
|
|
|
|
developers.
|
2013-03-15 21:47:08 +08:00
|
|
|
|
|
|
|
If unsure, say N.
|
|
|
|
|
2013-04-23 00:12:31 +08:00
|
|
|
config BTRFS_DEBUG
|
|
|
|
bool "Btrfs debugging support"
|
|
|
|
depends on BTRFS_FS
|
|
|
|
help
|
|
|
|
Enable run-time debugging support for the btrfs filesystem. This may
|
|
|
|
enable additional and expensive checks with negative impact on
|
|
|
|
performance, or export extra information via sysfs.
|
|
|
|
|
|
|
|
If unsure, say N.
|
2013-08-27 04:53:15 +08:00
|
|
|
|
|
|
|
config BTRFS_ASSERT
|
|
|
|
bool "Btrfs assert support"
|
|
|
|
depends on BTRFS_FS
|
|
|
|
help
|
|
|
|
Enable run-time assertion checking. This will result in panics if
|
|
|
|
any of the assertions trip. This is meant for btrfs developers only.
|
|
|
|
|
|
|
|
If unsure, say N.
|
2017-09-30 03:43:50 +08:00
|
|
|
|
|
|
|
config BTRFS_FS_REF_VERIFY
|
|
|
|
bool "Btrfs with the ref verify tool compiled in"
|
|
|
|
depends on BTRFS_FS
|
|
|
|
default n
|
|
|
|
help
|
|
|
|
Enable run-time extent reference verification instrumentation. This
|
|
|
|
is meant to be used by btrfs developers for tracking down extent
|
|
|
|
reference problems or verifying they didn't break something.
|
|
|
|
|
|
|
|
If unsure, say N.
|