Commit b9b1a53e authored by Chengguang Xu's avatar Chengguang Xu Committed by David Sterba

btrfs: use enum for extent type defines

Use enum to replace macro definitions of extent types.
Signed-off-by: default avatarChengguang Xu <cgxu519@mykernel.net>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b2cd2959
...@@ -221,11 +221,11 @@ static int check_extent_data_item(struct extent_buffer *leaf, ...@@ -221,11 +221,11 @@ static int check_extent_data_item(struct extent_buffer *leaf,
fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item);
if (btrfs_file_extent_type(leaf, fi) > BTRFS_FILE_EXTENT_TYPES) { if (btrfs_file_extent_type(leaf, fi) >= BTRFS_NR_FILE_EXTENT_TYPES) {
file_extent_err(leaf, slot, file_extent_err(leaf, slot,
"invalid type for file extent, have %u expect range [0, %u]", "invalid type for file extent, have %u expect range [0, %u]",
btrfs_file_extent_type(leaf, fi), btrfs_file_extent_type(leaf, fi),
BTRFS_FILE_EXTENT_TYPES); BTRFS_NR_FILE_EXTENT_TYPES - 1);
return -EUCLEAN; return -EUCLEAN;
} }
......
...@@ -737,10 +737,12 @@ struct btrfs_balance_item { ...@@ -737,10 +737,12 @@ struct btrfs_balance_item {
__le64 unused[4]; __le64 unused[4];
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
#define BTRFS_FILE_EXTENT_INLINE 0 enum {
#define BTRFS_FILE_EXTENT_REG 1 BTRFS_FILE_EXTENT_INLINE = 0,
#define BTRFS_FILE_EXTENT_PREALLOC 2 BTRFS_FILE_EXTENT_REG = 1,
#define BTRFS_FILE_EXTENT_TYPES 2 BTRFS_FILE_EXTENT_PREALLOC = 2,
BTRFS_NR_FILE_EXTENT_TYPES = 3,
};
struct btrfs_file_extent_item { struct btrfs_file_extent_item {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment