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

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Mon Jul 24 10:09:41 MSK 2023


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 {
-- 
2.39.3



More information about the Devel mailing list