summaryrefslogtreecommitdiff
path: root/fs/bcachefs/extents.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-01-17 00:20:21 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-21 21:27:10 +0300
commitd7e77f53e90e1eb87838eed7c651531427b9114a (patch)
treef5e54a0751c8b51d9dcbd8522af1fb70e26331bf /fs/bcachefs/extents.c
parentec4edd7b9d2038a97e0ba3fad8fc8492b0d12d35 (diff)
downloadlinux-d7e77f53e90e1eb87838eed7c651531427b9114a.tar.xz
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/extents.c')
-rw-r--r--fs/bcachefs/extents.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index 3ae4aba4f151..61395b113df9 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -1335,10 +1335,12 @@ bool bch2_bkey_needs_rebalance(struct bch_fs *c, struct bkey_s_c k)
}
int bch2_bkey_set_needs_rebalance(struct bch_fs *c, struct bkey_i *_k,
- unsigned target, unsigned compression)
+ struct bch_io_opts *opts)
{
struct bkey_s k = bkey_i_to_s(_k);
struct bch_extent_rebalance *r;
+ unsigned target = opts->background_target;
+ unsigned compression = background_compression(*opts);
bool needs_rebalance;
if (!bkey_extent_is_direct_data(k.k))