[Devel] [PATCH RH9 v2 6/8] dm/dm-ploop: reinforce some defines
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Wed Aug 16 12:32:53 MSK 2023
Add braces around arguments so callers can use equations while
calling these macros.
Feature: dm: implement SEEK_HOLE for dm-qcow2 and dm-ploop
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 646b107c4300..9c9fc16a0de5 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