diff options
author | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-06-28 12:04:55 -0400 |
---|---|---|
committer | Jan Schmidt <list.btrfs@jan-o-sch.net> | 2012-07-12 04:54:37 -0400 |
commit | edf39272db4810282360f7362d43ade1d524c913 (patch) | |
tree | 930d440538a3ab719234dfff0d6aec7968f15b7f /fs | |
parent | bed92eae26ccf280d1a2168b7509447b56675a27 (diff) |
Btrfs: call the qgroup accounting functions
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 3 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 1a63b830846..c08337a83ac 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2479,6 +2479,8 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, | |||
2479 | 2 * 1024 * 1024, btrfs_get_alloc_profile(root, 0), | 2479 | 2 * 1024 * 1024, btrfs_get_alloc_profile(root, 0), |
2480 | CHUNK_ALLOC_NO_FORCE); | 2480 | CHUNK_ALLOC_NO_FORCE); |
2481 | 2481 | ||
2482 | btrfs_delayed_refs_qgroup_accounting(trans, root->fs_info); | ||
2483 | |||
2482 | delayed_refs = &trans->transaction->delayed_refs; | 2484 | delayed_refs = &trans->transaction->delayed_refs; |
2483 | INIT_LIST_HEAD(&cluster); | 2485 | INIT_LIST_HEAD(&cluster); |
2484 | again: | 2486 | again: |
@@ -2588,6 +2590,7 @@ again: | |||
2588 | } | 2590 | } |
2589 | out: | 2591 | out: |
2590 | spin_unlock(&delayed_refs->lock); | 2592 | spin_unlock(&delayed_refs->lock); |
2593 | assert_qgroups_uptodate(trans); | ||
2591 | return 0; | 2594 | return 0; |
2592 | } | 2595 | } |
2593 | 2596 | ||
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 0d6c8816845..d20d2e24f8d 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -512,6 +512,11 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
512 | return 0; | 512 | return 0; |
513 | } | 513 | } |
514 | 514 | ||
515 | /* | ||
516 | * do the qgroup accounting as early as possible | ||
517 | */ | ||
518 | err = btrfs_delayed_refs_qgroup_accounting(trans, info); | ||
519 | |||
515 | btrfs_trans_release_metadata(trans, root); | 520 | btrfs_trans_release_metadata(trans, root); |
516 | trans->block_rsv = NULL; | 521 | trans->block_rsv = NULL; |
517 | /* | 522 | /* |
@@ -571,6 +576,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
571 | root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { | 576 | root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { |
572 | err = -EIO; | 577 | err = -EIO; |
573 | } | 578 | } |
579 | assert_qgroups_uptodate(trans); | ||
574 | 580 | ||
575 | memset(trans, 0, sizeof(*trans)); | 581 | memset(trans, 0, sizeof(*trans)); |
576 | kmem_cache_free(btrfs_trans_handle_cachep, trans); | 582 | kmem_cache_free(btrfs_trans_handle_cachep, trans); |
@@ -1356,6 +1362,13 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1356 | goto cleanup_transaction; | 1362 | goto cleanup_transaction; |
1357 | 1363 | ||
1358 | /* | 1364 | /* |
1365 | * running the delayed items may have added new refs. account | ||
1366 | * them now so that they hinder processing of more delayed refs | ||
1367 | * as little as possible. | ||
1368 | */ | ||
1369 | btrfs_delayed_refs_qgroup_accounting(trans, root->fs_info); | ||
1370 | |||
1371 | /* | ||
1359 | * rename don't use btrfs_join_transaction, so, once we | 1372 | * rename don't use btrfs_join_transaction, so, once we |
1360 | * set the transaction to blocked above, we aren't going | 1373 | * set the transaction to blocked above, we aren't going |
1361 | * to get any new ordered operations. We can safely run | 1374 | * to get any new ordered operations. We can safely run |
@@ -1467,6 +1480,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1467 | root->fs_info->chunk_root->node); | 1480 | root->fs_info->chunk_root->node); |
1468 | switch_commit_root(root->fs_info->chunk_root); | 1481 | switch_commit_root(root->fs_info->chunk_root); |
1469 | 1482 | ||
1483 | assert_qgroups_uptodate(trans); | ||
1470 | update_super_roots(root); | 1484 | update_super_roots(root); |
1471 | 1485 | ||
1472 | if (!root->fs_info->log_root_recovering) { | 1486 | if (!root->fs_info->log_root_recovering) { |