[Devel] [PATCH 3/4] blk-cbt: Don't open-code is_power_of_2 function

Alexander Atanasov alexander.atanasov at virtuozzo.com
Fri Jan 27 16:35:28 MSK 2023


On 27.01.23 13:34, Nikolay Borisov wrote:
> Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
> ---
>   block/blk-cbt.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/blk-cbt.c b/block/blk-cbt.c
> index 269709c7589b..68c7f71ec3a0 100644
> --- a/block/blk-cbt.c
> +++ b/block/blk-cbt.c
> @@ -17,6 +17,7 @@
>   #include <linux/spinlock.h>
>   #include <linux/pagemap.h>
>   #include <linux/vmalloc.h>
> +#include <linux/log2.h>
>   #include <asm/atomic.h>
>   #include <asm/uaccess.h>
>   
> @@ -625,7 +626,7 @@ static int cbt_ioc_init(struct block_device *bdev, struct blk_user_cbt_info __us
>   	if (copy_from_user(&ci, ucbt_ioc, sizeof(ci)))
>   		return -EFAULT;
>   
> -	if (((ci.ci_blksize -1) & ci.ci_blksize))
> +	if (!is_power_of_2(ci.ci_blksize))
>   		return -EINVAL;
>   
>   	q = bdev_get_queue(bdev);

LGTM

-- 
Regards,
Alexander Atanasov



More information about the Devel mailing list