diff options
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 8c83cf464c83..444abe0796ae 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -477,6 +477,7 @@ static noinline int add_dirty_roots(struct btrfs_trans_handle *trans, | |||
477 | dirty = root->dirty_root; | 477 | dirty = root->dirty_root; |
478 | 478 | ||
479 | btrfs_free_log(trans, root); | 479 | btrfs_free_log(trans, root); |
480 | btrfs_free_reloc_root(root); | ||
480 | 481 | ||
481 | if (root->commit_root == root->node) { | 482 | if (root->commit_root == root->node) { |
482 | WARN_ON(root->node->start != | 483 | WARN_ON(root->node->start != |
@@ -855,6 +856,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
855 | * with the tree-log code. | 856 | * with the tree-log code. |
856 | */ | 857 | */ |
857 | mutex_lock(&root->fs_info->tree_log_mutex); | 858 | mutex_lock(&root->fs_info->tree_log_mutex); |
859 | /* | ||
860 | * keep tree reloc code from adding new reloc trees | ||
861 | */ | ||
862 | mutex_lock(&root->fs_info->tree_reloc_mutex); | ||
863 | |||
858 | 864 | ||
859 | ret = add_dirty_roots(trans, &root->fs_info->fs_roots_radix, | 865 | ret = add_dirty_roots(trans, &root->fs_info->fs_roots_radix, |
860 | &dirty_fs_roots); | 866 | &dirty_fs_roots); |
@@ -865,6 +871,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
865 | */ | 871 | */ |
866 | btrfs_free_log_root_tree(trans, root->fs_info); | 872 | btrfs_free_log_root_tree(trans, root->fs_info); |
867 | 873 | ||
874 | btrfs_free_reloc_mappings(root); | ||
875 | |||
868 | ret = btrfs_commit_tree_roots(trans, root); | 876 | ret = btrfs_commit_tree_roots(trans, root); |
869 | BUG_ON(ret); | 877 | BUG_ON(ret); |
870 | 878 | ||
@@ -910,10 +918,13 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
910 | mutex_unlock(&root->fs_info->tree_log_mutex); | 918 | mutex_unlock(&root->fs_info->tree_log_mutex); |
911 | 919 | ||
912 | btrfs_finish_extent_commit(trans, root, pinned_copy); | 920 | btrfs_finish_extent_commit(trans, root, pinned_copy); |
913 | mutex_lock(&root->fs_info->trans_mutex); | ||
914 | |||
915 | kfree(pinned_copy); | 921 | kfree(pinned_copy); |
916 | 922 | ||
923 | btrfs_drop_dead_reloc_roots(root); | ||
924 | mutex_unlock(&root->fs_info->tree_reloc_mutex); | ||
925 | |||
926 | mutex_lock(&root->fs_info->trans_mutex); | ||
927 | |||
917 | cur_trans->commit_done = 1; | 928 | cur_trans->commit_done = 1; |
918 | root->fs_info->last_trans_committed = cur_trans->transid; | 929 | root->fs_info->last_trans_committed = cur_trans->transid; |
919 | wake_up(&cur_trans->commit_wait); | 930 | wake_up(&cur_trans->commit_wait); |