btrfs: add btrfs_tree_block_status definitions to tree-checker.h
authorJosef Bacik <josef@toxicpanda.com>
Sat, 29 Apr 2023 20:07:13 +0000 (16:07 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:25 +0000 (13:59 +0200)
We use this in btrfs-progs to determine if we can fix different types of
corruptions.  We don't care about this in the kernel, however it would
be good to share this code between the kernel and btrfs-progs, so add
the status definitions so we can start converting the tree-checker code
over to using these status flags instead of blanket returning -EUCLEAN.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-checker.h

index 48321e8..78ee289 100644 (file)
@@ -40,6 +40,19 @@ struct btrfs_tree_parent_check {
        u8 level;
 };
 
+enum btrfs_tree_block_status {
+       BTRFS_TREE_BLOCK_CLEAN,
+       BTRFS_TREE_BLOCK_INVALID_NRITEMS,
+       BTRFS_TREE_BLOCK_INVALID_PARENT_KEY,
+       BTRFS_TREE_BLOCK_BAD_KEY_ORDER,
+       BTRFS_TREE_BLOCK_INVALID_LEVEL,
+       BTRFS_TREE_BLOCK_INVALID_FREE_SPACE,
+       BTRFS_TREE_BLOCK_INVALID_OFFSETS,
+       BTRFS_TREE_BLOCK_INVALID_BLOCKPTR,
+       BTRFS_TREE_BLOCK_INVALID_ITEM,
+       BTRFS_TREE_BLOCK_INVALID_OWNER,
+};
+
 int btrfs_check_leaf(struct extent_buffer *leaf);
 int btrfs_check_node(struct extent_buffer *node);