Maxim Patlasov <mpatla...@virtuozzo.com> writes:

> It's useless to recreate cbt every time as we called for the same
> block-device size. Actually, it's worthy only if cbt->block_max
> increases.
>
> Since commit b8e560a299 (fix cbt->block_max calculation), we calculate
> cbt->block_max precisely:
>
>>       cbt->block_max  = (size + blocksize - 1) >> cbt->block_bits;
>
> Hence, the following check:
>
>       if ((new_sz + bsz) >> cbt->block_bits <= cbt->block_max)
>               goto err_mtx;
>
> must be corrected accordingly.
>
ACK
> Signed-off-by: Maxim Patlasov <mpatla...@virtuozzo.com>
> ---
>  block/blk-cbt.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/blk-cbt.c b/block/blk-cbt.c
> index 3a2b197..4f2ce26 100644
> --- a/block/blk-cbt.c
> +++ b/block/blk-cbt.c
> @@ -440,7 +440,7 @@ void blk_cbt_update_size(struct block_device *bdev)
>               return;
>       }
>       bsz = 1 << cbt->block_bits;
> -     if ((new_sz + bsz) >> cbt->block_bits <= cbt->block_max)
> +     if ((new_sz + bsz - 1) >> cbt->block_bits <= cbt->block_max)
>               goto err_mtx;
>  
>       new = do_cbt_alloc(q, cbt->uuid, new_sz, bsz);

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to