summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/rebalance.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-01-16 16:20:21 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-21 13:27:10 -0500
commitd7e77f53e90e1eb87838eed7c651531427b9114a (patch)
treef5e54a0751c8b51d9dcbd8522af1fb70e26331bf /fs/bcachefs/rebalance.c
parentec4edd7b9d2038a97e0ba3fad8fc8492b0d12d35 (diff)
downloadlinux-stable-d7e77f53e90e1eb87838eed7c651531427b9114a.tar.gz
linux-stable-d7e77f53e90e1eb87838eed7c651531427b9114a.tar.bz2
linux-stable-d7e77f53e90e1eb87838eed7c651531427b9114a.zip
bcachefs: opts->compression can now also be applied in the background
The "apply this compression method in the background" paths now use the compression option if background_compression is not set; this means that setting or changing the compression option will cause existing data to be compressed accordingly in the background. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/rebalance.c')
-rw-r--r--fs/bcachefs/rebalance.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c
index 2d22efed981a..22d1017aa49b 100644
--- a/fs/bcachefs/rebalance.c
+++ b/fs/bcachefs/rebalance.c
@@ -253,13 +253,12 @@ static bool rebalance_pred(struct bch_fs *c, void *arg,
if (k.k->p.inode) {
target = io_opts->background_target;
- compression = io_opts->background_compression ?: io_opts->compression;
+ compression = background_compression(*io_opts);
} else {
const struct bch_extent_rebalance *r = bch2_bkey_rebalance_opts(k);
target = r ? r->target : io_opts->background_target;
- compression = r ? r->compression :
- (io_opts->background_compression ?: io_opts->compression);
+ compression = r ? r->compression : background_compression(*io_opts);
}
data_opts->rewrite_ptrs = bch2_bkey_ptrs_need_rebalance(c, k, target, compression);