return 1;
}
-/*
- * Check if this subvolume tree has valid reloc(*) tree.
- *
- * *: Reloc tree after swap is considered dead, thus not considered as valid.
- * This is enough for most callers, as they don't distinguish dead reloc
- * root from no reloc root.
- * But should_ignore_root() below is a special case.
- */
-static bool have_reloc_root(struct btrfs_root *root)
-{
- if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state))
- return false;
- if (!root->reloc_root)
- return false;
- return true;
-}
static int should_ignore_root(struct btrfs_root *root)
{
if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state))
return 0;
- /* This root has been merged with its reloc tree, we can ignore it */
- if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state))
- return 1;
-
reloc_root = root->reloc_root;
if (!reloc_root)
return 0;
struct btrfs_root_item *root_item;
int ret;
- if (!have_reloc_root(root))
+ if (test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state) ||
+ !root->reloc_root)
goto out;
reloc_root = root->reloc_root;
if (ret2 < 0 && !ret)
ret = ret2;
}
- /*
- * Need barrier to ensure clear_bit() only happens after
- * root->reloc_root = NULL.
- */
- smp_mb__before_atomic();
clear_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state);
btrfs_put_fs_root(root);
} else {
struct btrfs_root *root = pending->root;
struct reloc_control *rc = root->fs_info->reloc_ctl;
- if (!rc || !have_reloc_root(root))
+ if (!root->reloc_root || !rc)
return;
if (!rc->merge_reloc_tree)
struct reloc_control *rc = root->fs_info->reloc_ctl;
int ret;
- if (!rc || !have_reloc_root(root))
+ if (!root->reloc_root || !rc)
return 0;
rc = root->fs_info->reloc_ctl;