diff mbox series

[04/12] btrfs: add btrfs_tree_block_status definitions to tree-checker.h

Message ID d748a7c5d28648aafbe1e24b81b6db0e0ed4647c.1682798736.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs: various cleanups to make ctree.c sync easier | expand

Commit Message

Josef Bacik April 29, 2023, 8:07 p.m. UTC
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.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/tree-checker.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Johannes Thumshirn May 2, 2023, 11:32 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/tree-checker.h b/fs/btrfs/tree-checker.h
index 48321e8d91bb..5e06d9ad2862 100644
--- a/fs/btrfs/tree-checker.h
+++ b/fs/btrfs/tree-checker.h
@@ -40,6 +40,18 @@  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,
+};
+
 int btrfs_check_leaf(struct extent_buffer *leaf);
 int btrfs_check_node(struct extent_buffer *node);