diff options
-rw-r--r-- | fs/btrfs/extent-tree.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 375f8c728d91..a6635f07b8f1 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -7589,6 +7589,10 @@ search: | |||
7589 | u64 offset; | 7589 | u64 offset; |
7590 | int cached; | 7590 | int cached; |
7591 | 7591 | ||
7592 | /* If the block group is read-only, we can skip it entirely. */ | ||
7593 | if (unlikely(block_group->ro)) | ||
7594 | continue; | ||
7595 | |||
7592 | btrfs_grab_block_group(block_group, delalloc); | 7596 | btrfs_grab_block_group(block_group, delalloc); |
7593 | search_start = block_group->key.objectid; | 7597 | search_start = block_group->key.objectid; |
7594 | 7598 | ||
@@ -7624,8 +7628,6 @@ have_block_group: | |||
7624 | 7628 | ||
7625 | if (unlikely(block_group->cached == BTRFS_CACHE_ERROR)) | 7629 | if (unlikely(block_group->cached == BTRFS_CACHE_ERROR)) |
7626 | goto loop; | 7630 | goto loop; |
7627 | if (unlikely(block_group->ro)) | ||
7628 | goto loop; | ||
7629 | 7631 | ||
7630 | /* | 7632 | /* |
7631 | * Ok we want to try and use the cluster allocator, so | 7633 | * Ok we want to try and use the cluster allocator, so |
@@ -7839,6 +7841,7 @@ loop: | |||
7839 | failed_alloc = false; | 7841 | failed_alloc = false; |
7840 | BUG_ON(index != get_block_group_index(block_group)); | 7842 | BUG_ON(index != get_block_group_index(block_group)); |
7841 | btrfs_release_block_group(block_group, delalloc); | 7843 | btrfs_release_block_group(block_group, delalloc); |
7844 | cond_resched(); | ||
7842 | } | 7845 | } |
7843 | up_read(&space_info->groups_sem); | 7846 | up_read(&space_info->groups_sem); |
7844 | 7847 | ||