Message ID | 1e9e2015a56fb48dba859dff85f3eee1f69f74fc.1667244568.git.dsterba@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Minor cleanups | expand |
On 01/11/2022 03:33, David Sterba wrote: > We have a 64bit compatible helper to check if a value is a power of two, > use it instead of open coding it. > > Signed-off-by: David Sterba <dsterba@suse.com> Reviewed-by: Anand Jain <anand.jain@oracle.com>
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index 9d12a23e1a59..32a5aac1cccb 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -393,8 +393,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache) zone_sectors = bdev_zone_sectors(bdev); } - /* Check if it's power of 2 (see is_power_of_2) */ - ASSERT(zone_sectors != 0 && (zone_sectors & (zone_sectors - 1)) == 0); + ASSERT(is_power_of_two_u64(zone_sectors)); zone_info->zone_size = zone_sectors << SECTOR_SHIFT; /* We reject devices with a zone size larger than 8GB */
We have a 64bit compatible helper to check if a value is a power of two, use it instead of open coding it. Signed-off-by: David Sterba <dsterba@suse.com> --- fs/btrfs/zoned.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)