From 986e9842fb6825f65918ed400b29c8c878359b7a Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Wed, 12 Jul 2023 22:27:16 -0400 Subject: bcachefs: Compression levels This allows including a compression level when specifying a compression type, e.g. compression=zstd:15 Values from 1 through 15 indicate compression levels, 0 or unspecified indicates the default. For LZ4, values 3-15 specify that the HC algorithm should be used. Note that for compatibility, extents themselves only include the compression type, not the compression level. This means that specifying the same compression algorithm but different compression levels for the compression and background_compression options will have no effect. XXX: perhaps we could add a warning for this Signed-off-by: Kent Overstreet --- fs/bcachefs/rebalance.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/bcachefs/rebalance.c') diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c index 989f37a3b46a..c3d577236ce2 100644 --- a/fs/bcachefs/rebalance.c +++ b/fs/bcachefs/rebalance.c @@ -5,6 +5,7 @@ #include "btree_iter.h" #include "buckets.h" #include "clock.h" +#include "compress.h" #include "disk_groups.h" #include "errcode.h" #include "extents.h" @@ -45,7 +46,7 @@ static bool rebalance_pred(struct bch_fs *c, void *arg, bkey_for_each_ptr_decode(k.k, ptrs, p, entry) { if (!p.ptr.cached && p.crc.compression_type != - bch2_compression_opt_to_type[io_opts->background_compression]) + bch2_compression_opt_to_type(io_opts->background_compression)) data_opts->rewrite_ptrs |= 1U << i; i++; } -- cgit v1.2.3