]> git.hungrycats.org Git - linux/commitdiff
Revert "Btrfs: keep dropped roots in cache until transaciton commit"
authorZygo Blaxell <zblaxell@thirteen.furryterror.org>
Sat, 7 Nov 2015 23:11:15 +0000 (18:11 -0500)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Sat, 7 Nov 2015 23:11:15 +0000 (18:11 -0500)
This reverts commit dac5c87cd8da83d7fdf053e06007f191cf109042.

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

index caf81794b8a9dfdd5ee93e90228ab4495e314000..eb12c17c5d98dba141121039ffc8d5a1e2e8165c 100644 (file)
@@ -8989,7 +8989,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root,
        }
 
        if (test_bit(BTRFS_ROOT_IN_RADIX, &root->state)) {
-               btrfs_add_dropped_root(trans, root);
+               btrfs_drop_and_free_fs_root(tree_root->fs_info, root);
        } else {
                free_extent_buffer(root->node);
                free_extent_buffer(root->commit_root);
index ce521b09b84246297fce400bf1aae54051186b9c..f0691e3ae821fdf994df5582b57c5415248e34a8 100644 (file)
@@ -117,16 +117,6 @@ static noinline void switch_commit_roots(struct btrfs_transaction *trans,
                        btrfs_unpin_free_ino(root);
                clear_btree_io_tree(&root->dirty_log_pages);
        }
-
-       /* We can free old roots now. */
-       spin_lock(&trans->dropped_roots_lock);
-       while (!list_empty(&trans->dropped_roots)) {
-               root = list_first_entry(&trans->dropped_roots,
-                                       struct btrfs_root, root_list);
-               list_del_init(&root->root_list);
-               btrfs_drop_and_free_fs_root(fs_info, root);
-       }
-       spin_unlock(&trans->dropped_roots_lock);
        up_write(&fs_info->commit_root_sem);
 }
 
@@ -263,11 +253,9 @@ loop:
        INIT_LIST_HEAD(&cur_trans->switch_commits);
        INIT_LIST_HEAD(&cur_trans->dirty_bgs);
        INIT_LIST_HEAD(&cur_trans->io_bgs);
-       INIT_LIST_HEAD(&cur_trans->dropped_roots);
        mutex_init(&cur_trans->cache_write_mutex);
        cur_trans->num_dirty_bgs = 0;
        spin_lock_init(&cur_trans->dirty_bgs_lock);
-       spin_lock_init(&cur_trans->dropped_roots_lock);
        list_add_tail(&cur_trans->list, &fs_info->trans_list);
        extent_io_tree_init(&cur_trans->dirty_pages,
                             fs_info->btree_inode->i_mapping);
index d713d3205649cb909315a3c2fae5c88a4f6c3294..cae361c3d6485dbb4ae3e0523011f7fca13fa96d 100644 (file)
@@ -67,7 +67,6 @@ struct btrfs_transaction {
        struct list_head switch_commits;
        struct list_head dirty_bgs;
        struct list_head io_bgs;
-       struct list_head dropped_roots;
        u64 num_dirty_bgs;
 
        /*
@@ -77,7 +76,6 @@ struct btrfs_transaction {
         */
        struct mutex cache_write_mutex;
        spinlock_t dirty_bgs_lock;
-       spinlock_t dropped_roots_lock;
        struct btrfs_delayed_ref_root delayed_refs;
        int aborted;
 };
@@ -193,12 +191,4 @@ int btrfs_transaction_in_commit(struct btrfs_fs_info *info);
 void btrfs_put_transaction(struct btrfs_transaction *transaction);
 void btrfs_apply_pending_changes(struct btrfs_fs_info *fs_info);
 
-static inline void btrfs_add_dropped_root(struct btrfs_trans_handle *trans,
-                                         struct btrfs_root *root)
-{
-       struct btrfs_transaction *cur_trans = trans->transaction;
-       spin_lock(&cur_trans->dropped_roots_lock);
-       list_add_tail(&root->root_list, &cur_trans->dropped_roots);
-       spin_unlock(&cur_trans->dropped_roots_lock);
-}
 #endif