Commit fd463ac4 authored by David Sterba's avatar David Sterba

btrfs: zoned: use helper to check a power of two zone size

We have a 64bit compatible helper to check if a value is a power of two,
use it instead of open coding it.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 9e5e6d4e
...@@ -394,8 +394,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) ...@@ -394,8 +394,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
zone_sectors = bdev_zone_sectors(bdev); zone_sectors = bdev_zone_sectors(bdev);
} }
/* Check if it's power of 2 (see is_power_of_2) */ ASSERT(is_power_of_two_u64(zone_sectors));
ASSERT(zone_sectors != 0 && (zone_sectors & (zone_sectors - 1)) == 0);
zone_info->zone_size = zone_sectors << SECTOR_SHIFT; zone_info->zone_size = zone_sectors << SECTOR_SHIFT;
/* We reject devices with a zone size larger than 8GB */ /* We reject devices with a zone size larger than 8GB */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment