Re: [PATCH] btrfs: use common helper instead of open coding a bit test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 21.09.2018 15:26, David Sterba wrote:
> The helper does the same math and we take care about the special case
> when flags is 0 too.
> 
> Signed-off-by: David Sterba <dsterba@xxxxxxxx>
Reviewed-by: Nikolay Borisov <nborisov@xxxxxxxx>
> ---
>  fs/btrfs/volumes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 909c578506ee..26eb388db343 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)
> 



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux