From 65374767dd4499f64cbc1c8182d333b1155e3272 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 Reserve the following layout intent flags for PCCRO: LAYOUT_INTENT_PCCRO_SET = 7, /** set read-only layout for PCC */ LAYOUT_INTENT_PCCRO_CLEAR = 8, /** clear read-ony layout */ Test-Parameters: trivial Signed-off-by: Qian Yingjin Change-Id: If8a414103ab13155aa483179247c81908b6ced69 --- lustre/include/uapi/linux/lustre/lustre_idl.h | 2 + lustre/ptlrpc/wiretest.c | 66 +++++++++++++++++++++++-- lustre/utils/wirecheck.c | 41 ++++++++++++++++ lustre/utils/wiretest.c | 70 +++++++++++++++++++++++++-- 4 files changed, 171 insertions(+), 8 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 351f97b..e364241 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -3328,6 +3328,8 @@ enum layout_intent_opc { LAYOUT_INTENT_TRUNC = 4, /** truncate file, for comp layout */ LAYOUT_INTENT_RELEASE = 5, /** reserved for HSM release */ LAYOUT_INTENT_RESTORE = 6, /** reserved for HSM restore */ + LAYOUT_INTENT_PCCRO_SET = 7, /** set read-only layout for PCC */ + LAYOUT_INTENT_PCCRO_CLEAR = 8, /** clear read-only layout */ }; /* enqueue layout lock with intent */ diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index c0bbcab..5e8bbd3 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -4881,6 +4881,10 @@ void lustre_assert_wire_constants(void) (long long)LAYOUT_INTENT_RELEASE); LASSERTF(LAYOUT_INTENT_RESTORE == 6, "found %lld\n", (long long)LAYOUT_INTENT_RESTORE); + LASSERTF(LAYOUT_INTENT_PCCRO_SET == 7, "found %lld\n", + (long long)LAYOUT_INTENT_PCCRO_SET); + LASSERTF(LAYOUT_INTENT_PCCRO_CLEAR == 8, "found %lld\n", + (long long)LAYOUT_INTENT_PCCRO_CLEAR); /* Checks for struct hsm_action_item */ LASSERTF((int)sizeof(struct hsm_action_item) == 72, "found %lld\n", @@ -6063,9 +6067,9 @@ void lustre_assert_wire_constants(void) LASSERTF(LCFG_NODEMAP_ADMIN == 0x000ce049UL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_ADMIN); LASSERTF(LCFG_NODEMAP_ADD_PROJIDMAP == 0x000ce04aUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_ADD_PROJIDMAP); + (unsigned)LCFG_NODEMAP_ADD_PROJIDMAP); LASSERTF(LCFG_NODEMAP_DEL_PROJIDMAP == 0x000ce04bUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_DEL_PROJIDMAP); + (unsigned)LCFG_NODEMAP_DEL_PROJIDMAP); LASSERTF(LCFG_NODEMAP_TRUSTED == 0x000ce050UL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_TRUSTED); LASSERTF(LCFG_NODEMAP_SQUASH_UID == 0x000ce051UL, "found 0x%.8xUL\n", @@ -6091,7 +6095,7 @@ void lustre_assert_wire_constants(void) LASSERTF(LCFG_NODEMAP_SET_SEPOL == 0x000ce05bUL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_SET_SEPOL); LASSERTF(LCFG_NODEMAP_FORBID_ENCRYPT == 0x000ce05cUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_FORBID_ENCRYPT); + (unsigned)LCFG_NODEMAP_FORBID_ENCRYPT); LASSERTF(LCFG_NODEMAP_SQUASH_PROJID == 0x000ce05dUL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_SQUASH_PROJID); LASSERTF(LCFG_NODEMAP_READONLY_MOUNT == 0x000ce05eUL, "found 0x%.8xUL\n", @@ -6101,4 +6105,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 d58d8bd..9c19133 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -2388,6 +2388,8 @@ static void check_layout_intent(void) CHECK_VALUE(LAYOUT_INTENT_TRUNC); CHECK_VALUE(LAYOUT_INTENT_RELEASE); CHECK_VALUE(LAYOUT_INTENT_RESTORE); + CHECK_VALUE(LAYOUT_INTENT_PCCRO_SET); + CHECK_VALUE(LAYOUT_INTENT_PCCRO_CLEAR); } static void check_hsm_state_set(void) @@ -2889,6 +2891,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) { @@ -3302,6 +3338,11 @@ printf("#endif /* HAVE_SERVER_SUPPORT */\n"); #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 d99e5d8..e5d107e 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1618,7 +1618,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); @@ -2108,7 +2108,7 @@ void lustre_assert_wire_constants(void) LASSERTF(QIF_DQBLKSIZE_BITS == 10, "found %lld\n", (long long)QIF_DQBLKSIZE_BITS); LASSERTF(QIF_DQBLKSIZE == 1024, "found %lld\n", - (long long)QIF_DQBLKSIZE_BITS); + (long long)QIF_DQBLKSIZE); /* Checks for struct obd_quotactl */ LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n", @@ -4908,6 +4908,10 @@ void lustre_assert_wire_constants(void) (long long)LAYOUT_INTENT_RELEASE); LASSERTF(LAYOUT_INTENT_RESTORE == 6, "found %lld\n", (long long)LAYOUT_INTENT_RESTORE); + LASSERTF(LAYOUT_INTENT_PCCRO_SET == 7, "found %lld\n", + (long long)LAYOUT_INTENT_PCCRO_SET); + LASSERTF(LAYOUT_INTENT_PCCRO_CLEAR == 8, "found %lld\n", + (long long)LAYOUT_INTENT_PCCRO_CLEAR); /* Checks for struct hsm_action_item */ LASSERTF((int)sizeof(struct hsm_action_item) == 72, "found %lld\n", @@ -6090,9 +6094,9 @@ void lustre_assert_wire_constants(void) LASSERTF(LCFG_NODEMAP_ADMIN == 0x000ce049UL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_ADMIN); LASSERTF(LCFG_NODEMAP_ADD_PROJIDMAP == 0x000ce04aUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_ADD_PROJIDMAP); + (unsigned)LCFG_NODEMAP_ADD_PROJIDMAP); LASSERTF(LCFG_NODEMAP_DEL_PROJIDMAP == 0x000ce04bUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_DEL_PROJIDMAP); + (unsigned)LCFG_NODEMAP_DEL_PROJIDMAP); LASSERTF(LCFG_NODEMAP_TRUSTED == 0x000ce050UL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_TRUSTED); LASSERTF(LCFG_NODEMAP_SQUASH_UID == 0x000ce051UL, "found 0x%.8xUL\n", @@ -6118,7 +6122,7 @@ void lustre_assert_wire_constants(void) LASSERTF(LCFG_NODEMAP_SET_SEPOL == 0x000ce05bUL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_SET_SEPOL); LASSERTF(LCFG_NODEMAP_FORBID_ENCRYPT == 0x000ce05cUL, "found 0x%.8xUL\n", - (unsigned)LCFG_NODEMAP_FORBID_ENCRYPT); + (unsigned)LCFG_NODEMAP_FORBID_ENCRYPT); LASSERTF(LCFG_NODEMAP_SQUASH_PROJID == 0x000ce05dUL, "found 0x%.8xUL\n", (unsigned)LCFG_NODEMAP_SQUASH_PROJID); LASSERTF(LCFG_NODEMAP_READONLY_MOUNT == 0x000ce05eUL, "found 0x%.8xUL\n", @@ -6128,4 +6132,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