aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 885245f5acdc..b9eaa0f21144 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1747,7 +1747,7 @@ static int transaction_kthread(void *arg)
1747 } 1747 }
1748 1748
1749 now = get_seconds(); 1749 now = get_seconds();
1750 if (!cur->blocked && 1750 if (cur->state < TRANS_STATE_BLOCKED &&
1751 (now < cur->start_time || now - cur->start_time < 30)) { 1751 (now < cur->start_time || now - cur->start_time < 30)) {
1752 spin_unlock(&root->fs_info->trans_lock); 1752 spin_unlock(&root->fs_info->trans_lock);
1753 delay = HZ * 5; 1753 delay = HZ * 5;
@@ -2186,7 +2186,6 @@ int open_ctree(struct super_block *sb,
2186 fs_info->max_inline = 8192 * 1024; 2186 fs_info->max_inline = 8192 * 1024;
2187 fs_info->metadata_ratio = 0; 2187 fs_info->metadata_ratio = 0;
2188 fs_info->defrag_inodes = RB_ROOT; 2188 fs_info->defrag_inodes = RB_ROOT;
2189 fs_info->trans_no_join = 0;
2190 fs_info->free_chunk_space = 0; 2189 fs_info->free_chunk_space = 0;
2191 fs_info->tree_mod_log = RB_ROOT; 2190 fs_info->tree_mod_log = RB_ROOT;
2192 2191
@@ -3958,19 +3957,14 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
3958 btrfs_block_rsv_release(root, &root->fs_info->trans_block_rsv, 3957 btrfs_block_rsv_release(root, &root->fs_info->trans_block_rsv,
3959 cur_trans->dirty_pages.dirty_bytes); 3958 cur_trans->dirty_pages.dirty_bytes);
3960 3959
3961 /* FIXME: cleanup wait for commit */ 3960 cur_trans->state = TRANS_STATE_COMMIT_START;
3962 cur_trans->in_commit = 1;
3963 cur_trans->blocked = 1;
3964 wake_up(&root->fs_info->transaction_blocked_wait); 3961 wake_up(&root->fs_info->transaction_blocked_wait);
3965 3962
3966 btrfs_evict_pending_snapshots(cur_trans); 3963 btrfs_evict_pending_snapshots(cur_trans);
3967 3964
3968 cur_trans->blocked = 0; 3965 cur_trans->state = TRANS_STATE_UNBLOCKED;
3969 wake_up(&root->fs_info->transaction_wait); 3966 wake_up(&root->fs_info->transaction_wait);
3970 3967
3971 cur_trans->commit_done = 1;
3972 wake_up(&cur_trans->commit_wait);
3973
3974 btrfs_destroy_delayed_inodes(root); 3968 btrfs_destroy_delayed_inodes(root);
3975 btrfs_assert_delayed_root_empty(root); 3969 btrfs_assert_delayed_root_empty(root);
3976 3970
@@ -3979,6 +3973,9 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
3979 btrfs_destroy_pinned_extent(root, 3973 btrfs_destroy_pinned_extent(root,
3980 root->fs_info->pinned_extents); 3974 root->fs_info->pinned_extents);
3981 3975
3976 cur_trans->state =TRANS_STATE_COMPLETED;
3977 wake_up(&cur_trans->commit_wait);
3978
3982 /* 3979 /*
3983 memset(cur_trans, 0, sizeof(*cur_trans)); 3980 memset(cur_trans, 0, sizeof(*cur_trans));
3984 kmem_cache_free(btrfs_transaction_cachep, cur_trans); 3981 kmem_cache_free(btrfs_transaction_cachep, cur_trans);
@@ -4006,25 +4003,23 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root)
4006 4003
4007 btrfs_destroy_delayed_refs(t, root); 4004 btrfs_destroy_delayed_refs(t, root);
4008 4005
4009 /* FIXME: cleanup wait for commit */ 4006 /*
4010 t->in_commit = 1; 4007 * FIXME: cleanup wait for commit
4011 t->blocked = 1; 4008 * We needn't acquire the lock here, because we are during
4009 * the umount, there is no other task which will change it.
4010 */
4011 t->state = TRANS_STATE_COMMIT_START;
4012 smp_mb(); 4012 smp_mb();
4013 if (waitqueue_active(&root->fs_info->transaction_blocked_wait)) 4013 if (waitqueue_active(&root->fs_info->transaction_blocked_wait))
4014 wake_up(&root->fs_info->transaction_blocked_wait); 4014 wake_up(&root->fs_info->transaction_blocked_wait);
4015 4015
4016 btrfs_evict_pending_snapshots(t); 4016 btrfs_evict_pending_snapshots(t);
4017 4017
4018 t->blocked = 0; 4018 t->state = TRANS_STATE_UNBLOCKED;
4019 smp_mb(); 4019 smp_mb();
4020 if (waitqueue_active(&root->fs_info->transaction_wait)) 4020 if (waitqueue_active(&root->fs_info->transaction_wait))
4021 wake_up(&root->fs_info->transaction_wait); 4021 wake_up(&root->fs_info->transaction_wait);
4022 4022
4023 t->commit_done = 1;
4024 smp_mb();
4025 if (waitqueue_active(&t->commit_wait))
4026 wake_up(&t->commit_wait);
4027
4028 btrfs_destroy_delayed_inodes(root); 4023 btrfs_destroy_delayed_inodes(root);
4029 btrfs_assert_delayed_root_empty(root); 4024 btrfs_assert_delayed_root_empty(root);
4030 4025
@@ -4036,6 +4031,11 @@ static int btrfs_cleanup_transaction(struct btrfs_root *root)
4036 btrfs_destroy_pinned_extent(root, 4031 btrfs_destroy_pinned_extent(root,
4037 root->fs_info->pinned_extents); 4032 root->fs_info->pinned_extents);
4038 4033
4034 t->state = TRANS_STATE_COMPLETED;
4035 smp_mb();
4036 if (waitqueue_active(&t->commit_wait))
4037 wake_up(&t->commit_wait);
4038
4039 atomic_set(&t->use_count, 0); 4039 atomic_set(&t->use_count, 0);
4040 list_del_init(&t->list); 4040 list_del_init(&t->list);
4041 memset(t, 0, sizeof(*t)); 4041 memset(t, 0, sizeof(*t));