]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: zoned: exit btrfs_can_activate_zone if BTRFS_FS_NEED_ZONE_FINISH is set
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Wed, 12 Feb 2025 14:05:00 +0000 (15:05 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:42 +0000 (20:35 +0100)
If BTRFS_FS_NEED_ZONE_FINISH is already set for the whole filesystem, exit
early in btrfs_can_activate_zone(). There's no need to check if
BTRFS_FS_NEED_ZONE_FINISH needs to be set if it is already set.

Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/zoned.c

index 73e0aa9fc08a5d2f7ca1e83da6c3cd28489295d8..4956baf8220ae39adaa28d134cf703bf85e09610 100644 (file)
@@ -2325,6 +2325,9 @@ bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, u64 flags)
        if (!btrfs_is_zoned(fs_info))
                return true;
 
+       if (test_bit(BTRFS_FS_NEED_ZONE_FINISH, &fs_info->flags))
+               return false;
+
        /* Check if there is a device with active zones left */
        mutex_lock(&fs_info->chunk_mutex);
        spin_lock(&fs_info->zone_active_bgs_lock);