]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
btrfs: use common helper instead of open coding a bit test
authorDavid Sterba <dsterba@suse.com>
Fri, 21 Sep 2018 12:26:34 +0000 (14:26 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 15 Oct 2018 15:23:35 +0000 (17:23 +0200)
The helper does the same math and we take care about the special case
when flags is 0 too.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index 909c578506eec42671b7de96327cb2121b2be47e..26eb388db343588183b5f06eb782daa32d91bef3 100644 (file)
@@ -3691,7 +3691,7 @@ static int alloc_profile_is_valid(u64 flags, int extended)
                return !extended; /* "0" is valid for usual profiles */
 
        /* true if exactly one bit set */
-       return (flags & (flags - 1)) == 0;
+       return is_power_of_2(flags);
 }
 
 static inline int balance_need_close(struct btrfs_fs_info *fs_info)