]> git.hungrycats.org Git - linux/commitdiff
Revert "Btrfs: prepare block group cache before writing"
authorZygo Blaxell <zblaxell@serenity.furryterror.org>
Tue, 31 Mar 2015 15:43:35 +0000 (11:43 -0400)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Tue, 31 Mar 2015 15:43:35 +0000 (11:43 -0400)
This reverts commit 387186fd8683bbb5211df238527632db758017ab.

fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/transaction.c

index 07192e0a18943cb8b4a6a241bba20a10c3b4f568..47fba0af81c199bc2c078a55af6d4c6d9e79f2db 100644 (file)
@@ -3320,8 +3320,6 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
 
 int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
                                    struct btrfs_root *root);
-int btrfs_setup_space_cache(struct btrfs_trans_handle *trans,
-                           struct btrfs_root *root);
 int btrfs_extent_readonly(struct btrfs_root *root, u64 bytenr);
 int btrfs_free_block_groups(struct btrfs_fs_info *info);
 int btrfs_read_block_groups(struct btrfs_root *root);
index 1ee661a9dbe0007eeb1c089f809c6e89c7e4451e..2d6bf48b0b11cc688f50620aa48068f9b0b2f1a5 100644 (file)
@@ -3311,32 +3311,6 @@ out:
        return ret;
 }
 
-int btrfs_setup_space_cache(struct btrfs_trans_handle *trans,
-                           struct btrfs_root *root)
-{
-       struct btrfs_block_group_cache *cache, *tmp;
-       struct btrfs_transaction *cur_trans = trans->transaction;
-       struct btrfs_path *path;
-
-       if (list_empty(&cur_trans->dirty_bgs) ||
-           !btrfs_test_opt(root, SPACE_CACHE))
-               return 0;
-
-       path = btrfs_alloc_path();
-       if (!path)
-               return -ENOMEM;
-
-       /* Could add new block groups, use _safe just in case */
-       list_for_each_entry_safe(cache, tmp, &cur_trans->dirty_bgs,
-                                dirty_list) {
-               if (cache->disk_cache_state == BTRFS_DC_CLEAR)
-                       cache_save_setup(cache, trans, path);
-       }
-
-       btrfs_free_path(path);
-       return 0;
-}
-
 int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
                                   struct btrfs_root *root)
 {
index b7be7a6ad3b1f80337bf7a87726b345096038016..36d0d80cd2b94843df1476d5d53f040402882856 100644 (file)
@@ -960,6 +960,7 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans,
        struct btrfs_root *tree_root = root->fs_info->tree_root;
 
        old_root_used = btrfs_root_used(&root->root_item);
+       btrfs_write_dirty_block_groups(trans, root);
 
        while (1) {
                old_root_bytenr = btrfs_root_bytenr(&root->root_item);
@@ -1023,10 +1024,6 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans,
        if (ret)
                return ret;
 
-       ret = btrfs_setup_space_cache(trans, root);
-       if (ret)
-               return ret;
-
        /* run_qgroups might have added some more refs */
        ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1);
        if (ret)