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/extents.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'fs/bcachefs/extents.h') diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h index 7c5a41e6d79d..0d8554172263 100644 --- a/fs/bcachefs/extents.h +++ b/fs/bcachefs/extents.h @@ -175,6 +175,12 @@ bch2_extent_crc_unpack(const struct bkey *k, const union bch_extent_crc *crc) #undef common_fields } +static inline bool crc_is_compressed(struct bch_extent_crc_unpacked crc) +{ + return (crc.compression_type != BCH_COMPRESSION_TYPE_none && + crc.compression_type != BCH_COMPRESSION_TYPE_incompressible); +} + /* bkey_ptrs: generically over any key type that has ptrs */ struct bkey_ptrs_c { @@ -483,6 +489,7 @@ static inline struct bch_devs_list bch2_bkey_cached_devs(struct bkey_s_c k) unsigned bch2_bkey_nr_ptrs(struct bkey_s_c); unsigned bch2_bkey_nr_ptrs_allocated(struct bkey_s_c); unsigned bch2_bkey_nr_ptrs_fully_allocated(struct bkey_s_c); +bool bch2_bkey_is_incompressible(struct bkey_s_c); unsigned bch2_bkey_sectors_compressed(struct bkey_s_c); bool bch2_check_range_allocated(struct bch_fs *, struct bpos, u64, unsigned); unsigned bch2_bkey_durability(struct bch_fs *, struct bkey_s_c); -- cgit v1.2.3