aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <clm@fb.com>2015-12-30 10:52:35 -0500
committerChris Mason <clm@fb.com>2015-12-30 10:52:35 -0500
commit511711af91f21d80b27f18b569352d6896562828 (patch)
tree105c99f81073dfe5ce3b15623491f65778bf2032 /fs/btrfs/disk-io.c
parentb4570aa994b8fdb3a9c04ed80a6cac69072d4d42 (diff)
btrfs: don't run delayed references while we are creating the free space tree
This is a short term solution to make sure btrfs_run_delayed_refs() doesn't change the extent tree while we are scanning it to create the free space tree. Longer term we need to synchronize scanning the block groups one by one, similar to what happens during a balance. Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 823c1ce87e2e..dc6b73a95342 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3065,6 +3065,18 @@ retry_root_backup:
3065 if (sb->s_flags & MS_RDONLY) 3065 if (sb->s_flags & MS_RDONLY)
3066 return 0; 3066 return 0;
3067 3067
3068 if (btrfs_test_opt(tree_root, FREE_SPACE_TREE) &&
3069 !btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) {
3070 pr_info("BTRFS: creating free space tree\n");
3071 ret = btrfs_create_free_space_tree(fs_info);
3072 if (ret) {
3073 pr_warn("BTRFS: failed to create free space tree %d\n",
3074 ret);
3075 close_ctree(tree_root);
3076 return ret;
3077 }
3078 }
3079
3068 down_read(&fs_info->cleanup_work_sem); 3080 down_read(&fs_info->cleanup_work_sem);
3069 if ((ret = btrfs_orphan_cleanup(fs_info->fs_root)) || 3081 if ((ret = btrfs_orphan_cleanup(fs_info->fs_root)) ||
3070 (ret = btrfs_orphan_cleanup(fs_info->tree_root))) { 3082 (ret = btrfs_orphan_cleanup(fs_info->tree_root))) {
@@ -3102,18 +3114,6 @@ retry_root_backup:
3102 } 3114 }
3103 } 3115 }
3104 3116
3105 if (btrfs_test_opt(tree_root, FREE_SPACE_TREE) &&
3106 !btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) {
3107 pr_info("BTRFS: creating free space tree\n");
3108 ret = btrfs_create_free_space_tree(fs_info);
3109 if (ret) {
3110 pr_warn("BTRFS: failed to create free space tree %d\n",
3111 ret);
3112 close_ctree(tree_root);
3113 return ret;
3114 }
3115 }
3116
3117 if (!fs_info->uuid_root) { 3117 if (!fs_info->uuid_root) {
3118 pr_info("BTRFS: creating UUID tree\n"); 3118 pr_info("BTRFS: creating UUID tree\n");
3119 ret = btrfs_create_uuid_tree(fs_info); 3119 ret = btrfs_create_uuid_tree(fs_info);