Re: [PATCH] zbd: fixup ->zone_size_log2 if zone size is not power of 2

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

 



On 2020/04/07 4:56, Alexey Dobriyan wrote:
> Code like this doesn't work if log2 is 0xffffffff.
> 
> 	if (f->zbd_info->zone_size_log2 > 0)
>                 zone_idx = offset >> f->zbd_info->zone_size_log2;
>         else
>                 zone_idx = offset / f->zbd_info->zone_size;
> 
> Other than that everything else works!
> 
> Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@xxxxxxxxx>

Looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@xxxxxxx>

> ---
> 
>  zbd.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/zbd.c
> +++ b/zbd.c
> @@ -393,7 +393,7 @@ static int init_zone_info(struct thread_data *td, struct fio_file *f)
>  	f->zbd_info = zbd_info;
>  	f->zbd_info->zone_size = zone_size;
>  	f->zbd_info->zone_size_log2 = is_power_of_2(zone_size) ?
> -		ilog2(zone_size) : -1;
> +		ilog2(zone_size) : 0;
>  	f->zbd_info->nr_zones = nr_zones;
>  	pthread_mutexattr_destroy(&attr);
>  	return 0;
> @@ -510,7 +510,7 @@ static int parse_zone_info(struct thread_data *td, struct fio_file *f)
>  	f->zbd_info = zbd_info;
>  	f->zbd_info->zone_size = zone_size;
>  	f->zbd_info->zone_size_log2 = is_power_of_2(zone_size) ?
> -		ilog2(zone_size) : -1;
> +		ilog2(zone_size) : 0;
>  	f->zbd_info->nr_zones = nr_zones;
>  	zbd_info = NULL;
>  	ret = 0;
> 


-- 
Damien Le Moal
Western Digital Research




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux