|
@@ -242,7 +242,8 @@ static int check_leaf_item(struct btrfs_root *root,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-int btrfs_check_leaf(struct btrfs_root *root, struct extent_buffer *leaf)
|
|
|
+static int check_leaf(struct btrfs_root *root, struct extent_buffer *leaf,
|
|
|
+ bool check_item_data)
|
|
|
{
|
|
|
struct btrfs_fs_info *fs_info = root->fs_info;
|
|
|
/* No valid key type is 0, so all key should be larger than this key */
|
|
@@ -361,10 +362,15 @@ int btrfs_check_leaf(struct btrfs_root *root, struct extent_buffer *leaf)
|
|
|
return -EUCLEAN;
|
|
|
}
|
|
|
|
|
|
- /* Check if the item size and content meet other criteria */
|
|
|
- ret = check_leaf_item(root, leaf, &key, slot);
|
|
|
- if (ret < 0)
|
|
|
- return ret;
|
|
|
+ if (check_item_data) {
|
|
|
+ /*
|
|
|
+ * Check if the item size and content meet other
|
|
|
+ * criteria
|
|
|
+ */
|
|
|
+ ret = check_leaf_item(root, leaf, &key, slot);
|
|
|
+ if (ret < 0)
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
|
|
|
prev_key.objectid = key.objectid;
|
|
|
prev_key.type = key.type;
|
|
@@ -374,6 +380,17 @@ int btrfs_check_leaf(struct btrfs_root *root, struct extent_buffer *leaf)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int btrfs_check_leaf_full(struct btrfs_root *root, struct extent_buffer *leaf)
|
|
|
+{
|
|
|
+ return check_leaf(root, leaf, true);
|
|
|
+}
|
|
|
+
|
|
|
+int btrfs_check_leaf_relaxed(struct btrfs_root *root,
|
|
|
+ struct extent_buffer *leaf)
|
|
|
+{
|
|
|
+ return check_leaf(root, leaf, false);
|
|
|
+}
|
|
|
+
|
|
|
int btrfs_check_node(struct btrfs_root *root, struct extent_buffer *node)
|
|
|
{
|
|
|
unsigned long nr = btrfs_header_nritems(node);
|