aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2012-06-26 16:13:18 -0400
committerChris Mason <chris.mason@fusionio.com>2012-07-23 16:27:55 -0400
commit0e721106923be82f651dd0ee504742a8a3eb089f (patch)
tree03503ad628e903b381cd0a1874eaeb796359634c /fs/btrfs/extent-tree.c
parentb9959295151625c17723103afd79077e80b24ddd (diff)
Btrfs: change how we indicate we're adding csums
There is weird logic I had to put in place to make sure that when we were adding csums that we'd used the delalloc block rsv instead of the global block rsv. Part of this meant that we had to free up our transaction reservation before we ran the delayed refs since csum deletion happens during the delayed ref work. The problem with this is that when we release a reservation we will add it to the global reserve if it is not full in order to keep us going along longer before we have to force a transaction commit. By releasing our reservation before we run delayed refs we don't get the opportunity to drain down the global reserve for the work we did, so we won't refill it as often. This isn't a problem per-se, it just results in us possibly committing transactions more and more often, and in rare cases could cause those WARN_ON()'s to pop in use_block_rsv because we ran out of space in our block rsv. This also helps us by holding onto space while the delayed refs run so we don't end up with as many people trying to do things at the same time, which again will help us not force commits or hit the use_block_rsv warnings. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 3cde907a25a5..ec0328bb86db 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3961,7 +3961,10 @@ static struct btrfs_block_rsv *get_block_rsv(
3961{ 3961{
3962 struct btrfs_block_rsv *block_rsv = NULL; 3962 struct btrfs_block_rsv *block_rsv = NULL;
3963 3963
3964 if (root->ref_cows || root == root->fs_info->csum_root) 3964 if (root->ref_cows)
3965 block_rsv = trans->block_rsv;
3966
3967 if (root == root->fs_info->csum_root && trans->adding_csums)
3965 block_rsv = trans->block_rsv; 3968 block_rsv = trans->block_rsv;
3966 3969
3967 if (!block_rsv) 3970 if (!block_rsv)
@@ -4313,6 +4316,9 @@ static void release_global_block_rsv(struct btrfs_fs_info *fs_info)
4313void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans, 4316void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans,
4314 struct btrfs_root *root) 4317 struct btrfs_root *root)
4315{ 4318{
4319 if (!trans->block_rsv)
4320 return;
4321
4316 if (!trans->bytes_reserved) 4322 if (!trans->bytes_reserved)
4317 return; 4323 return;
4318 4324