Whamcloud - gitweb
LU-5896 wirecheck: add swap layout structs to wirecheck 73/54473/8
authorCourrier Guillaume <guillaume.courrier@cea.fr>
Tue, 19 Mar 2024 10:52:43 +0000 (11:52 +0100)
committerOleg Drokin <green@whamcloud.com>
Sun, 2 Feb 2025 06:19:49 +0000 (06:19 +0000)
For the support of blocking migrations, the MDS_SWAP_LAYOUTS RPC needs
to be updated. Wire checks were missing for some structs related to this
RPC. This patch introduces those checks to make sure that the new RPC
layout will not introduce layout changes in the structures.

Signed-off-by: Courrier Guillaume <guillaume.courrier@cea.fr>
Change-Id: I77b19bf6a4cf03bdcb4995bd83cb00ab52195cfe
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54473
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Etienne AUJAMES <eaujames@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index eb05529..eb85067 100644 (file)
@@ -5358,6 +5358,50 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((struct hsm_user_state *)0)->hus_in_progress_location) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct hsm_user_state *)0)->hus_in_progress_location));
 
+       /* Checks for struct lustre_swap_layouts */
+       LASSERTF((int)sizeof(struct lustre_swap_layouts) == 32, "found %lld\n",
+                (long long)(int)sizeof(struct lustre_swap_layouts));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_flags) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_flags));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_flags) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_flags));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_fd) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_fd));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_fd) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_fd));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_gid) == 12, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_gid));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_gid) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_gid));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_dv1) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_dv1));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_dv1) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_dv1));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_dv2) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_dv2));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_dv2) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_dv2));
+
+       /* Checks for struct mdc_swap_layouts */
+       LASSERTF((int)sizeof(struct mdc_swap_layouts) == 8, "found %lld\n",
+                (long long)(int)sizeof(struct mdc_swap_layouts));
+       LASSERTF((int)offsetof(struct mdc_swap_layouts, msl_flags) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct mdc_swap_layouts, msl_flags));
+       LASSERTF((int)sizeof(((struct mdc_swap_layouts *)0)->msl_flags) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdc_swap_layouts *)0)->msl_flags));
+
+       /* Checks for mdc_swap_layouts::msl_flags */
+       LASSERTF(SWAP_LAYOUTS_CHECK_DV1 == 1, "found %lld\n",
+                (long long)SWAP_LAYOUTS_CHECK_DV1);
+       LASSERTF(SWAP_LAYOUTS_CHECK_DV2 == 2, "found %lld\n",
+                (long long)SWAP_LAYOUTS_CHECK_DV2);
+       LASSERTF(SWAP_LAYOUTS_KEEP_MTIME == 4, "found %lld\n",
+                (long long)SWAP_LAYOUTS_KEEP_MTIME);
+       LASSERTF(SWAP_LAYOUTS_KEEP_ATIME == 8, "found %lld\n",
+                (long long)SWAP_LAYOUTS_KEEP_ATIME);
+       LASSERTF(SWAP_LAYOUTS_CLOSE == 16, "found %lld\n",
+                (long long)SWAP_LAYOUTS_CLOSE);
+
        /* Checks for struct hsm_state_set */
        LASSERTF((int)sizeof(struct hsm_state_set) == 24, "found %lld\n",
                 (long long)(int)sizeof(struct hsm_state_set));
index f6bef37..ccb1baa 100644 (file)
@@ -2550,6 +2550,31 @@ static void check_layout_intent(void)
        CHECK_VALUE(LAIF_INCOMPRESSIBLE);
 }
 
+static void check_swap_layout(void)
+{
+       BLANK_LINE();
+       CHECK_STRUCT(lustre_swap_layouts);
+       CHECK_MEMBER(lustre_swap_layouts, sl_flags);
+       CHECK_MEMBER(lustre_swap_layouts, sl_fd);
+       CHECK_MEMBER(lustre_swap_layouts, sl_gid);
+       CHECK_MEMBER(lustre_swap_layouts, sl_dv1);
+       CHECK_MEMBER(lustre_swap_layouts, sl_dv2);
+
+       BLANK_LINE();
+       CHECK_STRUCT(mdc_swap_layouts);
+       CHECK_MEMBER(mdc_swap_layouts, msl_flags);
+
+       BLANK_LINE();
+       COMMENT("Checks for mdc_swap_layouts::msl_flags");
+       CHECK_VALUE(SWAP_LAYOUTS_CHECK_DV1);
+       CHECK_VALUE(SWAP_LAYOUTS_CHECK_DV2);
+       CHECK_VALUE(SWAP_LAYOUTS_KEEP_MTIME);
+       CHECK_VALUE(SWAP_LAYOUTS_KEEP_ATIME);
+       CHECK_VALUE(SWAP_LAYOUTS_CLOSE);
+       CHECK_VALUE(SWAP_LAYOUTS_MDS_RELEASE);
+
+}
+
 static void check_hsm_state_set(void)
 {
        BLANK_LINE();
@@ -3737,6 +3762,7 @@ main(int argc, char **argv)
        check_hsm_progress_kernel();
        check_hsm_user_item();
        check_hsm_user_state();
+       check_swap_layout();
        check_hsm_state_set();
        check_hsm_current_action();
        check_hsm_request();
index fde6012..d68ddd2 100644 (file)
@@ -5383,6 +5383,50 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((struct hsm_user_state *)0)->hus_in_progress_location) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct hsm_user_state *)0)->hus_in_progress_location));
 
+       /* Checks for struct lustre_swap_layouts */
+       LASSERTF((int)sizeof(struct lustre_swap_layouts) == 32, "found %lld\n",
+                (long long)(int)sizeof(struct lustre_swap_layouts));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_flags) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_flags));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_flags) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_flags));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_fd) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_fd));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_fd) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_fd));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_gid) == 12, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_gid));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_gid) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_gid));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_dv1) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_dv1));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_dv1) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_dv1));
+       LASSERTF((int)offsetof(struct lustre_swap_layouts, sl_dv2) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_swap_layouts, sl_dv2));
+       LASSERTF((int)sizeof(((struct lustre_swap_layouts *)0)->sl_dv2) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_swap_layouts *)0)->sl_dv2));
+
+       /* Checks for struct mdc_swap_layouts */
+       LASSERTF((int)sizeof(struct mdc_swap_layouts) == 8, "found %lld\n",
+                (long long)(int)sizeof(struct mdc_swap_layouts));
+       LASSERTF((int)offsetof(struct mdc_swap_layouts, msl_flags) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct mdc_swap_layouts, msl_flags));
+       LASSERTF((int)sizeof(((struct mdc_swap_layouts *)0)->msl_flags) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdc_swap_layouts *)0)->msl_flags));
+
+       /* Checks for mdc_swap_layouts::msl_flags */
+       LASSERTF(SWAP_LAYOUTS_CHECK_DV1 == 1, "found %lld\n",
+                (long long)SWAP_LAYOUTS_CHECK_DV1);
+       LASSERTF(SWAP_LAYOUTS_CHECK_DV2 == 2, "found %lld\n",
+                (long long)SWAP_LAYOUTS_CHECK_DV2);
+       LASSERTF(SWAP_LAYOUTS_KEEP_MTIME == 4, "found %lld\n",
+                (long long)SWAP_LAYOUTS_KEEP_MTIME);
+       LASSERTF(SWAP_LAYOUTS_KEEP_ATIME == 8, "found %lld\n",
+                (long long)SWAP_LAYOUTS_KEEP_ATIME);
+       LASSERTF(SWAP_LAYOUTS_CLOSE == 16, "found %lld\n",
+                (long long)SWAP_LAYOUTS_CLOSE);
+
        /* Checks for struct hsm_state_set */
        LASSERTF((int)sizeof(struct hsm_state_set) == 24, "found %lld\n",
                 (long long)(int)sizeof(struct hsm_state_set));