aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2012-01-06 15:23:57 -0500
committerChris Mason <chris.mason@oracle.com>2012-01-06 15:23:57 -0500
commit203bf287cb01a5dc26c20bd3737cecf3aeba1d48 (patch)
treef9ce9d7c82360bd6059b5ef16166cf79d16b1380 /fs/btrfs/transaction.c
parentc1111b1fcee6359922ad8e5f6d72ed43815ad8f9 (diff)
Btrfs: run chunk allocations while we do delayed refs
Btrfs tries to batch extent allocation tree changes to improve performance and reduce metadata trashing. But it doesn't allocate new metadata chunks while it is doing allocations for the extent allocation tree. This commit changes the delayed refence code to do chunk allocations if we're getting low on room. It prevents crashes and improves performance. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 81376d94cd3c..360c2dfd1ee6 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -467,19 +467,12 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
467 467
468 btrfs_trans_release_metadata(trans, root); 468 btrfs_trans_release_metadata(trans, root);
469 trans->block_rsv = NULL; 469 trans->block_rsv = NULL;
470 while (count < 4) { 470 while (count < 2) {
471 unsigned long cur = trans->delayed_ref_updates; 471 unsigned long cur = trans->delayed_ref_updates;
472 trans->delayed_ref_updates = 0; 472 trans->delayed_ref_updates = 0;
473 if (cur && 473 if (cur &&
474 trans->transaction->delayed_refs.num_heads_ready > 64) { 474 trans->transaction->delayed_refs.num_heads_ready > 64) {
475 trans->delayed_ref_updates = 0; 475 trans->delayed_ref_updates = 0;
476
477 /*
478 * do a full flush if the transaction is trying
479 * to close
480 */
481 if (trans->transaction->delayed_refs.flushing)
482 cur = 0;
483 btrfs_run_delayed_refs(trans, root, cur); 476 btrfs_run_delayed_refs(trans, root, cur);
484 } else { 477 } else {
485 break; 478 break;