From: Alexandre Oliva Date: Wed, 30 Nov 2011 18:43:00 +0000 (-0500) Subject: Btrfs: skip allocation attempt from empty cluster X-Git-Tag: v3.12-rc1~4220^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be064d113906f04ea13088a8260e1e68ae0a4050;p=kernel%2Fkernel-generic.git Btrfs: skip allocation attempt from empty cluster If we don't have a cluster, don't bother trying to allocate from it, jumping right away to the attempt to allocate a new cluster. Signed-off-by: Alexandre Oliva Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 71c8e70..813c6bb 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5299,9 +5299,9 @@ alloc: * people trying to start a new cluster */ spin_lock(&last_ptr->refill_lock); - if (last_ptr->block_group && - (last_ptr->block_group->ro || - !block_group_bits(last_ptr->block_group, data))) + if (!last_ptr->block_group || + last_ptr->block_group->ro || + !block_group_bits(last_ptr->block_group, data)) goto refill_cluster; offset = btrfs_alloc_from_cluster(block_group, last_ptr,