aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 664782c6a2df..01b143605ec1 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -53,8 +53,6 @@ static noinline int join_transaction(struct btrfs_root *root)
53 GFP_NOFS); 53 GFP_NOFS);
54 BUG_ON(!cur_trans); 54 BUG_ON(!cur_trans);
55 root->fs_info->generation++; 55 root->fs_info->generation++;
56 root->fs_info->last_alloc = 0;
57 root->fs_info->last_data_alloc = 0;
58 cur_trans->num_writers = 1; 56 cur_trans->num_writers = 1;
59 cur_trans->num_joined = 0; 57 cur_trans->num_joined = 0;
60 cur_trans->transid = root->fs_info->generation; 58 cur_trans->transid = root->fs_info->generation;
@@ -689,7 +687,13 @@ static noinline int wait_transaction_pre_flush(struct btrfs_fs_info *info)
689 prepare_to_wait(&info->transaction_wait, &wait, 687 prepare_to_wait(&info->transaction_wait, &wait,
690 TASK_UNINTERRUPTIBLE); 688 TASK_UNINTERRUPTIBLE);
691 mutex_unlock(&info->trans_mutex); 689 mutex_unlock(&info->trans_mutex);
690
691 atomic_dec(&info->throttles);
692 wake_up(&info->transaction_throttle);
693
692 schedule(); 694 schedule();
695
696 atomic_inc(&info->throttles);
693 mutex_lock(&info->trans_mutex); 697 mutex_lock(&info->trans_mutex);
694 finish_wait(&info->transaction_wait, &wait); 698 finish_wait(&info->transaction_wait, &wait);
695 } 699 }
@@ -974,6 +978,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
974 int ret; 978 int ret;
975 int should_grow = 0; 979 int should_grow = 0;
976 unsigned long now = get_seconds(); 980 unsigned long now = get_seconds();
981 int flush_on_commit = btrfs_test_opt(root, FLUSHONCOMMIT);
977 982
978 btrfs_run_ordered_operations(root, 0); 983 btrfs_run_ordered_operations(root, 0);
979 984
@@ -1053,7 +1058,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1053 1058
1054 mutex_unlock(&root->fs_info->trans_mutex); 1059 mutex_unlock(&root->fs_info->trans_mutex);
1055 1060
1056 if (snap_pending) { 1061 if (flush_on_commit || snap_pending) {
1062 if (flush_on_commit)
1063 btrfs_start_delalloc_inodes(root);
1057 ret = btrfs_wait_ordered_extents(root, 1); 1064 ret = btrfs_wait_ordered_extents(root, 1);
1058 BUG_ON(ret); 1065 BUG_ON(ret);
1059 } 1066 }