From: David Sterba Date: Fri, 21 Sep 2018 12:26:34 +0000 (+0200) Subject: btrfs: use common helper instead of open coding a bit test X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=818255feece6e2a432328020d78c8a81a153ce65;p=linux.git btrfs: use common helper instead of open coding a bit test The helper does the same math and we take care about the special case when flags is 0 too. Reviewed-by: Nikolay Borisov Signed-off-by: David Sterba --- diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 909c578506eec..26eb388db3435 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -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)