From ab05de4ce4a1b806773e59b97a59bcfabba57d8d Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Fri, 23 Feb 2018 16:26:10 -0500 Subject: 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 Signed-off-by: Kent Overstreet --- fs/bcachefs/checksum.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/bcachefs/checksum.c') 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, -- cgit v1.2.3