Skip to content

Commit

Permalink
btrfs: call btrfs_create_pending_block_groups unconditionally
Browse files Browse the repository at this point in the history
The first thing we do is loop through the list, this

if (!list_empty())
	btrfs_create_pending_block_groups();

thing is just wasted space.

Reviewed-by: Nikolay Borisov <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
josefbacik authored and kdave committed Feb 25, 2019
1 parent fa781ce commit 119e80d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3013,8 +3013,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
}

if (run_all) {
if (!list_empty(&trans->new_bgs))
btrfs_create_pending_block_groups(trans);
btrfs_create_pending_block_groups(trans);

spin_lock(&delayed_refs->lock);
node = rb_first_cached(&delayed_refs->href_root);
Expand Down
6 changes: 2 additions & 4 deletions fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
btrfs_trans_release_metadata(trans);
trans->block_rsv = NULL;

if (!list_empty(&trans->new_bgs))
btrfs_create_pending_block_groups(trans);
btrfs_create_pending_block_groups(trans);

btrfs_trans_release_chunk_metadata(trans);

Expand Down Expand Up @@ -1943,8 +1942,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
cur_trans->delayed_refs.flushing = 1;
smp_wmb();

if (!list_empty(&trans->new_bgs))
btrfs_create_pending_block_groups(trans);
btrfs_create_pending_block_groups(trans);

ret = btrfs_run_delayed_refs(trans, 0);
if (ret) {
Expand Down

0 comments on commit 119e80d

Please sign in to comment.