summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/extents.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-10-22 11:33:02 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-31 12:18:37 -0400
commit9db2f86060a8e54e80f99e3c3366832ce6a67d76 (patch)
treee83bd22e7eae0465b2098e5b20e605b32afcc7e7 /fs/bcachefs/extents.h
parent2d39081291470750cc605c917531d7cd85aebf94 (diff)
downloadlinux-9db2f86060a8e54e80f99e3c3366832ce6a67d76.tar.gz
linux-9db2f86060a8e54e80f99e3c3366832ce6a67d76.tar.bz2
linux-9db2f86060a8e54e80f99e3c3366832ce6a67d76.zip
bcachefs: Check for too-large encoded extents
We don't yet repair (split) them, just check. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/extents.h')
-rw-r--r--fs/bcachefs/extents.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h
index acf78f55bdff..ef1b9f18719d 100644
--- a/fs/bcachefs/extents.h
+++ b/fs/bcachefs/extents.h
@@ -190,6 +190,11 @@ static inline bool crc_is_compressed(struct bch_extent_crc_unpacked crc)
crc.compression_type != BCH_COMPRESSION_TYPE_incompressible);
}
+static inline bool crc_is_encoded(struct bch_extent_crc_unpacked crc)
+{
+ return crc.csum_type != BCH_CSUM_none || crc_is_compressed(crc);
+}
+
/* bkey_ptrs: generically over any key type that has ptrs */
struct bkey_ptrs_c {