From e92c2d26be2e84b64cda8d1c8af3cc815d388382 Mon Sep 17 00:00:00 2001 From: Qian Yingjin Date: Sat, 2 Apr 2022 05:26:29 -0400 Subject: [PATCH] LU-15714 pcc: reserve layout intent flags for PCCRO Add wirecheck checks for PCCRO data structures struct lu_pcc_attach, lu_pcc_detach, lu_pcc_state Test-Parameters: trivial Signed-off-by: Qian Yingjin Change-Id: If8a414103ab13155aa483179247c81908b6ced69 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46981 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Feng Lei Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/ptlrpc/wiretest.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ lustre/utils/wirecheck.c | 39 ++++++++++++++++++++++++++++++++ lustre/utils/wiretest.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 152 insertions(+), 1 deletion(-) diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 5cafbf3..774c1e0 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -7008,4 +7008,60 @@ void lustre_assert_wire_constants(void) (long long)PORTALS_CFG_TYPE); LASSERTF(LUSTRE_CFG_TYPE == 123, "found %lld\n", (long long)LUSTRE_CFG_TYPE); + + /* Checks for struct lu_pcc_attach */ + LASSERTF((int)sizeof(struct lu_pcc_attach) == 8, "found %lld\n", + (long long)(int)sizeof(struct lu_pcc_attach)); + LASSERTF((int)offsetof(struct lu_pcc_attach, pcca_type) == 0, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_attach, pcca_type)); + LASSERTF((int)sizeof(((struct lu_pcc_attach *)0)->pcca_type) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_attach *)0)->pcca_type)); + LASSERTF((int)offsetof(struct lu_pcc_attach, pcca_id) == 4, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_attach, pcca_id)); + LASSERTF((int)sizeof(((struct lu_pcc_attach *)0)->pcca_id) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_attach *)0)->pcca_id)); + + /* Checks for struct lu_pcc_detach */ + LASSERTF((int)sizeof(struct lu_pcc_detach) == 4, "found %lld\n", + (long long)(int)sizeof(struct lu_pcc_detach)); + LASSERTF((int)offsetof(struct lu_pcc_detach, pccd_opt) == 0, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_detach, pccd_opt)); + LASSERTF((int)sizeof(((struct lu_pcc_detach *)0)->pccd_opt) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_detach *)0)->pccd_opt)); + + /* Checks for struct lu_pcc_detach_fid */ + LASSERTF((int)sizeof(struct lu_pcc_detach_fid) == 20, "found %lld\n", + (long long)(int)sizeof(struct lu_pcc_detach_fid)); + LASSERTF((int)offsetof(struct lu_pcc_detach_fid, pccd_fid) == 0, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_detach_fid, pccd_fid)); + LASSERTF((int)sizeof(((struct lu_pcc_detach_fid *)0)->pccd_fid) == 16, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_detach_fid *)0)->pccd_fid)); + LASSERTF((int)offsetof(struct lu_pcc_detach_fid, pccd_opt) == 16, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_detach_fid, pccd_opt)); + LASSERTF((int)sizeof(((struct lu_pcc_detach_fid *)0)->pccd_opt) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_detach_fid *)0)->pccd_opt)); + + /* Checks for struct lu_pcc_state */ + LASSERTF((int)sizeof(struct lu_pcc_state) == 4112, "found %lld\n", + (long long)(int)sizeof(struct lu_pcc_state)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_type) == 0, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_type)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_type) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_type)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_open_count) == 4, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_open_count)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_open_count) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_open_count)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_flags) == 8, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_flags)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_flags) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_flags)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_padding) == 12, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_padding)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_padding) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_padding)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_path) == 16, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_path)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_path) == 4096, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_path)); } diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 6c6b62c..da7bac0 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -3284,6 +3284,40 @@ check_lustre_cfg(void) CHECK_VALUE(LUSTRE_CFG_TYPE); } +static void check_lu_pcc_attach(void) +{ + BLANK_LINE(); + CHECK_STRUCT(lu_pcc_attach); + CHECK_MEMBER(lu_pcc_attach, pcca_type); + CHECK_MEMBER(lu_pcc_attach, pcca_id); +} + +static void check_lu_pcc_detach(void) +{ + BLANK_LINE(); + CHECK_STRUCT(lu_pcc_detach); + CHECK_MEMBER(lu_pcc_detach, pccd_opt); +} + +static void check_lu_pcc_detach_fid(void) +{ + BLANK_LINE(); + CHECK_STRUCT(lu_pcc_detach_fid); + CHECK_MEMBER(lu_pcc_detach_fid, pccd_fid); + CHECK_MEMBER(lu_pcc_detach_fid, pccd_opt); +} + +static void check_lu_pcc_state(void) +{ + BLANK_LINE(); + CHECK_STRUCT(lu_pcc_state); + CHECK_MEMBER(lu_pcc_state, pccs_type); + CHECK_MEMBER(lu_pcc_state, pccs_open_count); + CHECK_MEMBER(lu_pcc_state, pccs_flags); + CHECK_MEMBER(lu_pcc_state, pccs_padding); + CHECK_MEMBER(lu_pcc_state, pccs_path); +} + int main(int argc, char **argv) { @@ -3715,6 +3749,11 @@ main(int argc, char **argv) #endif /* !HAVE_NATIVE_LINUX_CLIENT */ check_lustre_cfg(); + check_lu_pcc_attach(); + check_lu_pcc_detach(); + check_lu_pcc_detach_fid(); + check_lu_pcc_state(); + printf("}\n"); return 0; diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index c320e4b..75543bc 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1657,7 +1657,7 @@ void lustre_assert_wire_constants(void) OBD_MD_FLGID); LASSERTF(OBD_MD_FLFLAGS == (0x00000800ULL), "found 0x%.16llxULL\n", OBD_MD_FLFLAGS); - LASSERTF(OBD_MD_DOM_SIZE == (0x00001000ULL), "found 0x%.16llxULL\n", + LASSERTF(OBD_MD_DOM_SIZE == (0X00001000ULL), "found 0x%.16llxULL\n", OBD_MD_DOM_SIZE); LASSERTF(OBD_MD_FLNLINK == (0x00002000ULL), "found 0x%.16llxULL\n", OBD_MD_FLNLINK); @@ -7033,4 +7033,60 @@ void lustre_assert_wire_constants(void) (long long)PORTALS_CFG_TYPE); LASSERTF(LUSTRE_CFG_TYPE == 123, "found %lld\n", (long long)LUSTRE_CFG_TYPE); + + /* Checks for struct lu_pcc_attach */ + LASSERTF((int)sizeof(struct lu_pcc_attach) == 8, "found %lld\n", + (long long)(int)sizeof(struct lu_pcc_attach)); + LASSERTF((int)offsetof(struct lu_pcc_attach, pcca_type) == 0, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_attach, pcca_type)); + LASSERTF((int)sizeof(((struct lu_pcc_attach *)0)->pcca_type) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_attach *)0)->pcca_type)); + LASSERTF((int)offsetof(struct lu_pcc_attach, pcca_id) == 4, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_attach, pcca_id)); + LASSERTF((int)sizeof(((struct lu_pcc_attach *)0)->pcca_id) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_attach *)0)->pcca_id)); + + /* Checks for struct lu_pcc_detach */ + LASSERTF((int)sizeof(struct lu_pcc_detach) == 4, "found %lld\n", + (long long)(int)sizeof(struct lu_pcc_detach)); + LASSERTF((int)offsetof(struct lu_pcc_detach, pccd_opt) == 0, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_detach, pccd_opt)); + LASSERTF((int)sizeof(((struct lu_pcc_detach *)0)->pccd_opt) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_detach *)0)->pccd_opt)); + + /* Checks for struct lu_pcc_detach_fid */ + LASSERTF((int)sizeof(struct lu_pcc_detach_fid) == 20, "found %lld\n", + (long long)(int)sizeof(struct lu_pcc_detach_fid)); + LASSERTF((int)offsetof(struct lu_pcc_detach_fid, pccd_fid) == 0, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_detach_fid, pccd_fid)); + LASSERTF((int)sizeof(((struct lu_pcc_detach_fid *)0)->pccd_fid) == 16, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_detach_fid *)0)->pccd_fid)); + LASSERTF((int)offsetof(struct lu_pcc_detach_fid, pccd_opt) == 16, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_detach_fid, pccd_opt)); + LASSERTF((int)sizeof(((struct lu_pcc_detach_fid *)0)->pccd_opt) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_detach_fid *)0)->pccd_opt)); + + /* Checks for struct lu_pcc_state */ + LASSERTF((int)sizeof(struct lu_pcc_state) == 4112, "found %lld\n", + (long long)(int)sizeof(struct lu_pcc_state)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_type) == 0, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_type)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_type) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_type)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_open_count) == 4, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_open_count)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_open_count) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_open_count)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_flags) == 8, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_flags)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_flags) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_flags)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_padding) == 12, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_padding)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_padding) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_padding)); + LASSERTF((int)offsetof(struct lu_pcc_state, pccs_path) == 16, "found %lld\n", + (long long)(int)offsetof(struct lu_pcc_state, pccs_path)); + LASSERTF((int)sizeof(((struct lu_pcc_state *)0)->pccs_path) == 4096, "found %lld\n", + (long long)(int)sizeof(((struct lu_pcc_state *)0)->pccs_path)); } -- 1.8.3.1