Skip to content

Commit

Permalink
btrfs-progs: mkfs: print which compression algos are compiled in
Browse files Browse the repository at this point in the history
The compression support is optional, eg. also in 'btrfs-restore', so
print the support in help text.

usage: mkfs.btrfs [options] <dev> [<dev...>]

...
    --compress ALGO[:LEVEL]   compress files by algorithm and level, ALGO can be 'no' (default), zstd, lzo, zlib
                              Built-in:
                              - ZSTD: yes
                              - LZO: yes
                              - ZLIB: yes
...

Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave committed Jan 22, 2025
1 parent 2bf30ba commit bf86e95
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Documentation/mkfs.btrfs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ OPTIONS
they would be larger than the uncompressed versions, and will set file attribute
*NOCOMPRESS* if its beginning is found to be incompressible.

.. note::
The support for ZSTD and LZO is a compile-time option, please check
the output of :command:`mkfs.btrfs --help` for the actual support.

-u|--subvol <type>:<subdir>
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
Expand Down
12 changes: 12 additions & 0 deletions mkfs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,18 @@ static const char * const mkfs_usage[] = {
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("", "Built-in:"),
#if COMPRESSION_ZSTD
OPTLINE("", "- ZSTD: yes"),
#else
OPTLINE("", "- ZSTD: no"),
#endif
#if COMPRESSION_LZO
OPTLINE("", "- LZO: yes"),
#else
OPTLINE("", "- LZO: no"),
#endif
OPTLINE("", "- ZLIB: yes"),
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"),
Expand Down

0 comments on commit bf86e95

Please sign in to comment.