Skip to contentSkip to conversation

Btrfs: fix qgroup sanity tests

PATCH In review Josef Bacik 2 participants 2 messages Oct 5, 2015 – Oct 7, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: fix qgroup sanity tests

With my changes to allow us to find old roots when resolving indirect refs I introduced a regression to the sanity tests. Since we don't really care to go down into the fs roots we just need to have the old behavior of returning ENOENT for dummy roots for the sanity tests. In the future if we want to get fancy we can populate the test fs trees with the references as well. Thanks,

---
 fs/btrfs/backref.c | 7 +++++++
 1 file changed, 7 insertions(+)
fs/btrfs/backref.c +7 -0
index 5de66e9..905d697 100644
@@ -339,6 +339,13 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
 		goto out;
 	}
 
+#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
+	if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) {
+		srcu_read_unlock(&fs_info->subvol_srcu, index);
+		ret = -ENOENT;
+		goto out;
+	}
+#endif
 	if (path->search_commit_root)
 		root_level = btrfs_header_level(root->commit_root);
 	else if (time_seq == (u64)-1)
Signature · 1 line
1.8.3.1
#1 lore raw

Review

Quoted 7 lines · Josef Bacik
(quoted diff) +7 -0
+#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
+	if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) {
+		srcu_read_unlock(&fs_info->subvol_srcu, index);
+		ret = -ENOENT;
+		goto out;
+	}
+#endif

The inline ifdefs are not necessary, please use the helper

fs/btrfs/backref.c +2 -3
@@ -362,13 +362,12 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
                goto out;
        }
 
-#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
-       if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) {
+       if (btrfs_test_is_dummy_root(root)) {
                srcu_read_unlock(&fs_info->subvol_srcu, index);
                ret = -ENOENT;
                goto out;
        }
-#endif
+
        if (path->search_commit_root)
                root_level = btrfs_header_level(root->commit_root);
        else if (time_seq == (u64)-1)