summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/checksum.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-02-23 22:26:10 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:08:34 +0200
commitab05de4ce4a1b806773e59b97a59bcfabba57d8d (patch)
tree0e5bbbc438c75ae60e126af14a889f26fbc9e93d /fs/bcachefs/checksum.c
parentbcachefs: Refactor rebalance_pred function (diff)
downloadlinux-ab05de4ce4a1b806773e59b97a59bcfabba57d8d.tar.xz
linux-ab05de4ce4a1b806773e59b97a59bcfabba57d8d.zip
bcachefs: Track incompressible data
This fixes the background_compression option: wihout some way of marking data as incompressible, rebalance will keep rewriting incompressible data over and over. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/checksum.c')
-rw-r--r--fs/bcachefs/checksum.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c
index 2e1dfdc68e15..3d88719ba86c 100644
--- a/fs/bcachefs/checksum.c
+++ b/fs/bcachefs/checksum.c
@@ -326,7 +326,7 @@ int bch2_rechecksum_bio(struct bch_fs *c, struct bio *bio,
BUG_ON(len_a + len_b > bio_sectors(bio));
BUG_ON(crc_old.uncompressed_size != bio_sectors(bio));
- BUG_ON(crc_old.compression_type);
+ BUG_ON(crc_is_compressed(crc_old));
BUG_ON(bch2_csum_type_is_encryption(crc_old.csum_type) !=
bch2_csum_type_is_encryption(new_csum_type));
@@ -355,6 +355,7 @@ int bch2_rechecksum_bio(struct bch_fs *c, struct bio *bio,
if (i->crc)
*i->crc = (struct bch_extent_crc_unpacked) {
.csum_type = i->csum_type,
+ .compression_type = crc_old.compression_type,
.compressed_size = i->len,
.uncompressed_size = i->len,
.offset = 0,