summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmds-check.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 7eb08b6c..791fab6b 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -11850,6 +11850,30 @@ static int check_tree_block_ref(struct btrfs_root *root,
if (!ret)
found_ref = 1;
}
+ /*
+ * Finally check SHARED BLOCK REF, any found will be good
+ * Here we're not doing comprehensive extent backref checking,
+ * only need to ensure there is some extent referring to this
+ * tree block.
+ */
+ if (!found_ref) {
+ btrfs_release_path(&path);
+ key.objectid = bytenr;
+ key.type = BTRFS_SHARED_BLOCK_REF_KEY;
+ key.offset = (u64)-1;
+
+ ret = btrfs_search_slot(NULL, extent_root, &key, &path, 0, 0);
+ if (ret < 0) {
+ err |= BACKREF_MISSING;
+ goto out;
+ }
+ ret = btrfs_previous_extent_item(extent_root, &path, bytenr);
+ if (ret) {
+ err |= BACKREF_MISSING;
+ goto out;
+ }
+ found_ref = 1;
+ }
if (!found_ref)
err |= BACKREF_MISSING;
out: