[Devel] [PATCH RH9 5/7] dm/dm-ploop: reinforce some defines

Alexander Atanasov alexander.atanasov at virtuozzo.com
Mon Jul 24 15:22:08 MSK 2023


On 24.07.23 11:03, Konstantin Khorenko wrote:
> Add braces around arguments so callers can use equations while
> calling these macro.
> 
> https://jira.vzint.dev/browse/PSBM-145746
> Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
> ---
>   drivers/md/dm-ploop.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/dm-ploop.h b/drivers/md/dm-ploop.h
> index bde1d28c9436..66882cf407a5 100644
> --- a/drivers/md/dm-ploop.h
> +++ b/drivers/md/dm-ploop.h
> @@ -79,11 +79,11 @@ struct ploop_cmd {
>    #define PLOOP_BIOS_HTABLE_BITS    8
>   #define PLOOP_BIOS_HTABLE_SIZE    (1 << PLOOP_BIOS_HTABLE_BITS)
> -#define CLU_OFF(ploop, pos) (pos & (to_bytes(1 << ploop->cluster_log) - 
> 1))
> -#define CLU_TO_POS(ploop, clu) to_bytes((loff_t)clu << ploop->cluster_log)
> +#define CLU_OFF(ploop, pos) ((pos) & (to_bytes(1 << ploop->cluster_log) 
> - 1))
> +#define CLU_TO_POS(ploop, clu) to_bytes((loff_t)(clu) << 
> ploop->cluster_log)
>   #define POS_TO_CLU(ploop, pos) (to_sector(pos) >> ploop->cluster_log)
> -#define SEC_TO_CLU(ploop, sec) (sec >> ploop->cluster_log)
> -#define CLU_TO_SEC(ploop, clu) ((sector_t)clu << ploop->cluster_log)
> +#define SEC_TO_CLU(ploop, sec) ((sec) >> ploop->cluster_log)
> +#define CLU_TO_SEC(ploop, clu) ((sector_t)(clu) << ploop->cluster_log)
>   #define CLU_SIZE(ploop) to_bytes((u32)1 << ploop->cluster_log)
>    enum piwb_type {


LGTM

Reviewed-By: Alexander Atanasov <alexander.atanasov at virtuozzo.com>

-- 
Regards,
Alexander Atanasov



More information about the Devel mailing list