Skip to content

Commit 162e0a1

Browse files
josefbacikkdave
authored andcommitted
btrfs: if we're restriping, use the target restripe profile
Previously we depended on some weird behavior in our chunk allocator to force the allocation of new stripes, so by the time we got to doing the reduce we would usually already have a chunk with the proper target. However that behavior causes other problems and needs to be removed. First however we need to remove this check to only restripe if we already have those available profiles, because if we're allocating our first chunk it obviously will not be available. Simply use the target as specified, and if that fails it'll be because we're out of space. Tested-by: Holger Hoffstätte <[email protected]> Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 349e120 commit 162e0a1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

fs/btrfs/block-group.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,8 @@ static u64 btrfs_reduce_alloc_profile(struct btrfs_fs_info *fs_info, u64 flags)
6565
spin_lock(&fs_info->balance_lock);
6666
target = get_restripe_target(fs_info, flags);
6767
if (target) {
68-
/* Pick target profile only if it's already available */
69-
if ((flags & target) & BTRFS_EXTENDED_PROFILE_MASK) {
70-
spin_unlock(&fs_info->balance_lock);
71-
return extended_to_chunk(target);
72-
}
68+
spin_unlock(&fs_info->balance_lock);
69+
return extended_to_chunk(target);
7370
}
7471
spin_unlock(&fs_info->balance_lock);
7572

0 commit comments

Comments
 (0)