aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-checker.c
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@mykernel.net>2019-10-10 15:59:57 +0800
committerDavid Sterba <dsterba@suse.com>2019-11-18 12:46:55 +0100
commitce96b7ffd11e261ef2ecd6817b7572a77750170d (patch)
tree653bc44cc799199b3d61d161689b320ae41b9858 /fs/btrfs/tree-checker.c
parentbtrfs: use enum for extent type defines (diff)
downloadlinux-dev-ce96b7ffd11e261ef2ecd6817b7572a77750170d.tar.xz
linux-dev-ce96b7ffd11e261ef2ecd6817b7572a77750170d.zip
btrfs: use better definition of number of compression type
The compression type upper limit constant is the same as the last value and this is confusing. In order to keep coding style consistent, use BTRFS_NR_COMPRESS_TYPES as the total number that follows the idom of 'NR' being one more than the last value. Signed-off-by: Chengguang Xu <cgxu519@mykernel.net> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-checker.c')
-rw-r--r--fs/btrfs/tree-checker.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
index 9699c91c958e..f4751615a189 100644
--- a/fs/btrfs/tree-checker.c
+++ b/fs/btrfs/tree-checker.c
@@ -233,11 +233,11 @@ static int check_extent_data_item(struct extent_buffer *leaf,
* Support for new compression/encryption must introduce incompat flag,
* and must be caught in open_ctree().
*/
- if (btrfs_file_extent_compression(leaf, fi) > BTRFS_COMPRESS_TYPES) {
+ if (btrfs_file_extent_compression(leaf, fi) >= BTRFS_NR_COMPRESS_TYPES) {
file_extent_err(leaf, slot,
"invalid compression for file extent, have %u expect range [0, %u]",
btrfs_file_extent_compression(leaf, fi),
- BTRFS_COMPRESS_TYPES);
+ BTRFS_NR_COMPRESS_TYPES - 1);
return -EUCLEAN;
}
if (btrfs_file_extent_encryption(leaf, fi)) {