Skip to content

Commit 9c90744

Browse files
committed
btrfs: drop incompat bit for raid1c34 after last block group is gone
When there are no raid1c3 or raid1c4 block groups left after balance (either convert or with other filters applied), remove the incompat bit. This is already done for RAID56, do the same for RAID1C34. Signed-off-by: David Sterba <[email protected]>
1 parent cfbb825 commit 9c90744

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

fs/btrfs/block-group.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -828,27 +828,36 @@ static void clear_avail_alloc_bits(struct btrfs_fs_info *fs_info, u64 flags)
828828
*
829829
* - RAID56 - in case there's neither RAID5 nor RAID6 profile block group
830830
* in the whole filesystem
831+
*
832+
* - RAID1C34 - same as above for RAID1C3 and RAID1C4 block groups
831833
*/
832834
static void clear_incompat_bg_bits(struct btrfs_fs_info *fs_info, u64 flags)
833835
{
834-
if (flags & BTRFS_BLOCK_GROUP_RAID56_MASK) {
836+
bool found_raid56 = false;
837+
bool found_raid1c34 = false;
838+
839+
if ((flags & BTRFS_BLOCK_GROUP_RAID56_MASK) ||
840+
(flags & BTRFS_BLOCK_GROUP_RAID1C3) ||
841+
(flags & BTRFS_BLOCK_GROUP_RAID1C4)) {
835842
struct list_head *head = &fs_info->space_info;
836843
struct btrfs_space_info *sinfo;
837844

838845
list_for_each_entry_rcu(sinfo, head, list) {
839-
bool found = false;
840-
841846
down_read(&sinfo->groups_sem);
842847
if (!list_empty(&sinfo->block_groups[BTRFS_RAID_RAID5]))
843-
found = true;
848+
found_raid56 = true;
844849
if (!list_empty(&sinfo->block_groups[BTRFS_RAID_RAID6]))
845-
found = true;
850+
found_raid56 = true;
851+
if (!list_empty(&sinfo->block_groups[BTRFS_RAID_RAID1C3]))
852+
found_raid1c34 = true;
853+
if (!list_empty(&sinfo->block_groups[BTRFS_RAID_RAID1C4]))
854+
found_raid1c34 = true;
846855
up_read(&sinfo->groups_sem);
847-
848-
if (found)
849-
return;
850856
}
851-
btrfs_clear_fs_incompat(fs_info, RAID56);
857+
if (found_raid56)
858+
btrfs_clear_fs_incompat(fs_info, RAID56);
859+
if (found_raid1c34)
860+
btrfs_clear_fs_incompat(fs_info, RAID1C34);
852861
}
853862
}
854863

0 commit comments

Comments
 (0)