summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/opts.h
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/opts.h
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/opts.h')
-rw-r--r--fs/bcachefs/opts.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h
index 7414c564b5d8..9a4b7faa3765 100644
--- a/fs/bcachefs/opts.h
+++ b/fs/bcachefs/opts.h
@@ -564,6 +564,11 @@ struct bch_io_opts {
#undef x
};
+static inline unsigned background_compression(struct bch_io_opts opts)
+{
+ return opts.background_compression ?: opts.compression;
+}
+
struct bch_io_opts bch2_opts_to_inode_opts(struct bch_opts);
bool bch2_opt_is_inode_opt(enum bch_opt_id);