]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/btrfs/extent-tree.c
Merge tag 'for-linus-20170825' of git://git.infradead.org/linux-mtd
[mirror_ubuntu-artful-kernel.git] / fs / btrfs / extent-tree.c
index 375f8c728d91888469a4820f1d669ea74c752b8c..e3b0b4196d3df173fd52d62076396f21029f073d 100644 (file)
@@ -4825,10 +4825,6 @@ skip_async:
                else
                        flush = BTRFS_RESERVE_NO_FLUSH;
                spin_lock(&space_info->lock);
-               if (can_overcommit(fs_info, space_info, orig, flush, false)) {
-                       spin_unlock(&space_info->lock);
-                       break;
-               }
                if (list_empty(&space_info->tickets) &&
                    list_empty(&space_info->priority_tickets)) {
                        spin_unlock(&space_info->lock);
@@ -7589,6 +7585,10 @@ search:
                u64 offset;
                int cached;
 
+               /* If the block group is read-only, we can skip it entirely. */
+               if (unlikely(block_group->ro))
+                       continue;
+
                btrfs_grab_block_group(block_group, delalloc);
                search_start = block_group->key.objectid;
 
@@ -7624,8 +7624,6 @@ have_block_group:
 
                if (unlikely(block_group->cached == BTRFS_CACHE_ERROR))
                        goto loop;
-               if (unlikely(block_group->ro))
-                       goto loop;
 
                /*
                 * Ok we want to try and use the cluster allocator, so
@@ -7839,6 +7837,7 @@ loop:
                failed_alloc = false;
                BUG_ON(index != get_block_group_index(block_group));
                btrfs_release_block_group(block_group, delalloc);
+               cond_resched();
        }
        up_read(&space_info->groups_sem);