From 4f4b1732698f0ec268468eaede8d0245221f23d6 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 22 Jan 2025 20:34:20 +0100 Subject: [PATCH] btrfs-progs: mkfs: update compression help and documentation Move the option documentation next to --rootdir, reword documentation. Signed-off-by: David Sterba --- Documentation/mkfs.btrfs.rst | 18 +++++++++--------- mkfs/main.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst index b830f8c5..d488502b 100644 --- a/Documentation/mkfs.btrfs.rst +++ b/Documentation/mkfs.btrfs.rst @@ -155,6 +155,15 @@ OPTIONS contain the files from *rootdir*. Since version 4.14.1 the filesystem size is not minimized. Please see option *--shrink* if you need that functionality. +--compress [:] + Try to compress files when using *--rootdir*. Supported values for *algo* are + *no* (the default), *zstd*, *lzo* or *zlib*. The optional value *level* is a + compression level, 1..15 for *zstd*, 1..9 for *zlib*. + + As with the kernel, :command:`mkfs.btrfs` won't write compressed extents when + they would be larger than the uncompressed versions, and will set file attribute + *NOCOMPRESS* if its beginning is found to be incompressible. + -u|--subvol : Specify that *subdir* is to be created as a subvolume rather than a regular directory. The option *--rootdir* must also be specified, and *subdir* must be an @@ -212,15 +221,6 @@ OPTIONS $ mkfs.btrfs -O list-all ---compress [:] - Try to compress files when using *--rootdir*. Supported values for *algo* are - *no* (the default), *zlib*, *lzo*, and *zstd*. The optional value *level* is a - compression level, from 1 to 9 for ZLIB and from 1 to 15 for ZSTD. - - As with the kernel, :command:`mkfs.btrfs` won't write compressed extents when - they would be larger than the uncompressed versions, and will mark a file as - `nocompress` if its beginning is found to be incompressible. - -f|--force Forcibly overwrite the block devices when an existing filesystem is detected. By default, :command:`mkfs.btrfs` will utilize *libblkid* to check for any known diff --git a/mkfs/main.c b/mkfs/main.c index 08d1e1f7..ce438a7f 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -441,10 +441,10 @@ static const char * const mkfs_usage[] = { "Creation:", OPTLINE("-b|--byte-count SIZE", "set size of each device to SIZE (filesystem size is sum of all device sizes)"), OPTLINE("-r|--rootdir DIR", "copy files from DIR to the image root directory"), + OPTLINE("--compress ALGO[:LEVEL]", "compress files by algorithm and level, ALGO can be 'no' (default), zstd, lzo, zlib"), OPTLINE("-u|--subvol TYPE:SUBDIR", "create SUBDIR as subvolume rather than normal directory, can be specified multiple times"), OPTLINE("--shrink", "(with --rootdir) shrink the filled filesystem to minimal size"), OPTLINE("-K|--nodiscard", "do not perform whole device TRIM"), - OPTLINE("--compress ALGO[:LEVEL]", "compression algorithm and level to use; ALGO can be no (default), zlib, lzo, zstd"), OPTLINE("-f|--force", "force overwrite of existing filesystem"), "", "General:",