]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
Btrfs: skip allocation attempt from empty cluster
authorAlexandre Oliva <oliva@lsd.ic.unicamp.br>
Wed, 30 Nov 2011 18:43:00 +0000 (13:43 -0500)
committerChris Mason <chris.mason@oracle.com>
Wed, 30 Nov 2011 18:43:00 +0000 (13:43 -0500)
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 <oliva@lsd.ic.unicamp.br>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c

index 71c8e7049d0c75c4cf56d3e5670ac6fa341a2cc6..813c6bb96c9a0c983c2dc1badcc6f89540571e8a 100644 (file)
@@ -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,