path: root/check
diff options
authorNikolay Borisov <>2018-06-08 15:47:57 +0300
committerDavid Sterba <>2018-10-23 14:48:41 +0200
commit909357e86799a338f40c9e997d1e3ba4adde3f89 (patch)
tree2b6ae9ec51a1daba8154614cd7567222bc6279bf /check
parentd8a5e756be6beb47d315165610f68f18ae21fe39 (diff)
btrfs-progs: Wire up delayed refs
This commit enables the delayed refs infrastructures. This entails doing the following: 1. Replacing existing calls of btrfs_extent_post_op (which is the equivalent of delayed refs) with the proper btrfs_run_delayed_refs. As well as eliminating open-coded calls to finish_current_insert and del_pending_extents which execute the delayed ops. 2. Wiring up the addition of delayed refs when freeing extents (btrfs_free_extent) and when adding new extents (alloc_tree_block). 3. Adding calls to btrfs_run_delayed refs in the transaction commit path alongside comments why every call is needed, since it's not always obvious (those call sites were derived empirically by running and debugging existing tests) 4. Correctly flagging the transaction in which we are reinitialising the extent tree. 5. Moving btrfs_write_dirty_block_groups to btrfs_write_dirty_block_groups since blockgroups should be written to disk after the last delayed refs have been run. Signed-off-by: Nikolay Borisov <> Signed-off-by: David Sterba <>
Diffstat (limited to 'check')
1 files changed, 2 insertions, 1 deletions
diff --git a/check/main.c b/check/main.c
index 40056f50..f44d5456 100644
--- a/check/main.c
+++ b/check/main.c
@@ -8718,7 +8718,7 @@ again:
fprintf(stderr, "Error adding block group\n");
return ret;
- btrfs_extent_post_op(trans);
+ btrfs_run_delayed_refs(trans, -1);
ret = reset_balance(trans, fs_info);
@@ -9775,6 +9775,7 @@ int cmd_check(int argc, char **argv)
goto close_out;
+ trans->reinit_extent_tree = true;
if (init_extent_tree) {
printf("Creating a new extent tree\n");
ret = reinit_extent_tree(trans, info,