aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-10-14 14:40:17 -0400
committerJosef Bacik <josef@redhat.com>2011-10-19 15:12:58 -0400
commitb24e03db0df3e9164c9649db12fecc8c2d81b0d1 (patch)
treee7742796bf98c1211babe8d1bdc464ad3e3a98a1 /fs/btrfs/transaction.c
parent877da174301dde9062b915da4c8103048be49702 (diff)
Btrfs: release trans metadata bytes before flushing delayed refs
We started setting trans->block_rsv = NULL to allow the delayed refs flushing stuff to use the right block_rsv and then just made btrfs_trans_release_metadata() unconditionally use the trans block rsv. The problem with this is we need to reserve some space in the transaction and then migrate it to the global block rsv, so we need to be able to free that out properly. So instead just move btrfs_trans_release_metadata() before the delayed ref flushing and use trans->block_rsv for the freeing. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 1e1a4816ccb0..d064fa0a4a07 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -462,6 +462,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
462 return 0; 462 return 0;
463 } 463 }
464 464
465 btrfs_trans_release_metadata(trans, root);
465 trans->block_rsv = NULL; 466 trans->block_rsv = NULL;
466 while (count < 4) { 467 while (count < 4) {
467 unsigned long cur = trans->delayed_ref_updates; 468 unsigned long cur = trans->delayed_ref_updates;
@@ -483,8 +484,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
483 count++; 484 count++;
484 } 485 }
485 486
486 btrfs_trans_release_metadata(trans, root);
487
488 if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) && 487 if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) &&
489 should_end_transaction(trans, root)) { 488 should_end_transaction(trans, root)) {
490 trans->transaction->blocked = 1; 489 trans->transaction->blocked = 1;
@@ -1128,6 +1127,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1128 1127
1129 btrfs_run_ordered_operations(root, 0); 1128 btrfs_run_ordered_operations(root, 0);
1130 1129
1130 btrfs_trans_release_metadata(trans, root);
1131 trans->block_rsv = NULL; 1131 trans->block_rsv = NULL;
1132 1132
1133 /* make a pass through all the delayed refs we have so far 1133 /* make a pass through all the delayed refs we have so far
@@ -1136,8 +1136,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1136 ret = btrfs_run_delayed_refs(trans, root, 0); 1136 ret = btrfs_run_delayed_refs(trans, root, 0);
1137 BUG_ON(ret); 1137 BUG_ON(ret);
1138 1138
1139 btrfs_trans_release_metadata(trans, root);
1140
1141 cur_trans = trans->transaction; 1139 cur_trans = trans->transaction;
1142 /* 1140 /*
1143 * set the flushing flag so procs in this transaction have to 1141 * set the flushing flag so procs in this transaction have to