[Devel] [PATCH rh7] cbt: blk_cbt_update_size() must return if cbt->block_max not changed

Dmitry Monakhov dmonakhov at openvz.org
Thu Jun 9 00:57:56 PDT 2016


Maxim Patlasov <mpatlasov at 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 <mpatlasov at 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/devel/attachments/20160609/af15e99d/attachment.sig>


More information about the Devel mailing list