Whamcloud - gitweb
LU-16518 lustre: fix implicit-fallthrough warnings 48/58348/2
authorTimothy Day <timday@amazon.com>
Sat, 8 Mar 2025 21:05:27 +0000 (16:05 -0500)
committerOleg Drokin <green@whamcloud.com>
Mon, 31 Mar 2025 05:56:40 +0000 (05:56 +0000)
Explicitly lable switch-case intentional fallthroughs
and reorder cases as needed to silence implicit-fallthrough
warngins as reported by Clang.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I7322b3e4f37bcd1716ca48a31ce698798b58e6cf
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58348
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/vvp_io.c
lustre/lod/lod_qos.c
lustre/lov/lov_io.c
lustre/mdd/mdd_object.c
lustre/mgs/mgs_nids.c
lustre/obdclass/cl_io.c
lustre/obdclass/obd_config.c
lustre/ptlrpc/lproc_ptlrpc.c
lustre/ptlrpc/nrs_orr.c
lustre/ptlrpc/sec.c

index 45cd1c6..65e5d9b 100644 (file)
@@ -64,8 +64,10 @@ static bool can_populate_pages(const struct lu_env *env, struct cl_io *io,
                        io->ci_continue = 0;
                        rc = false;
                }
+               fallthrough;
        case CIT_FAULT:
                /* fault is okay because we've already had a page. */
+               fallthrough;
        default:
                break;
        }
index 39fbd8d..f407131 100644 (file)
@@ -2468,7 +2468,7 @@ int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo,
        case __swab32(LOV_USER_MAGIC_COMP_V1):
                lustre_swab_lov_comp_md_v1(comp_v1);
                magic = comp_v1->lcm_magic;
-               /* fall trhough */
+               fallthrough;
        case LOV_USER_MAGIC_COMP_V1:
                break;
        case __swab32(LOV_USER_MAGIC_FOREIGN):
index 1a9199f..d00b53d 100644 (file)
@@ -1890,8 +1890,6 @@ int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj,
 
        lio->lis_object = lov;
        switch (io->ci_type) {
-       default:
-               LBUG();
        case CIT_MISC:
        case CIT_GLIMPSE:
        case CIT_READ:
@@ -1912,6 +1910,8 @@ int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj,
                CERROR("Page fault on a file without stripes: "DFID"\n",
                       PFID(lu_object_fid(&obj->co_lu)));
                break;
+       default:
+               LBUG();
        }
        if (result == 0) {
                cl_io_slice_add(io, &lio->lis_cl, obj, &lov_empty_io_ops);
index 80815a8..cb0cc41 100644 (file)
@@ -3528,6 +3528,7 @@ mdd_layout_change(const struct lu_env *env, struct md_object *o,
                if (intent->lai_opc == LAYOUT_INTENT_PCCRO_SET ||
                    intent->lai_opc == LAYOUT_INTENT_PCCRO_CLEAR)
                        RETURN(mdd_layout_update_pccro(env, o, mlc));
+               break;
        }
        case MD_LAYOUT_RESYNC:
        case MD_LAYOUT_RESYNC_DONE:
index 62eae1d..5f1722b 100644 (file)
@@ -578,6 +578,7 @@ int mgs_ir_update(const struct lu_env *env, struct mgs_device *mgs,
                break;
        case IR_DISABLED:
                notify = false;
+               fallthrough;
        case IR_STARTUP:
        case IR_PARTIAL:
                break;
index b4da6d5..0d64d04 100644 (file)
@@ -100,6 +100,7 @@ void cl_io_fini(const struct lu_env *env, struct cl_io *io)
                /* Check ignore layout change conf */
                LASSERT(ergo(io->ci_ignore_layout || !io->ci_verify_layout,
                                !io->ci_need_restart));
+               break;
        case CIT_GLIMPSE:
                break;
        case CIT_LADVISE:
index 09cec64..e72b1a7 100644 (file)
@@ -467,14 +467,14 @@ static int class_parse_value(char *buf, int opc, void *value, char **endh,
        tmp = *endp;
        *endp = '\0';
        switch (opc) {
-       default:
-               LBUG();
        case CLASS_PARSE_NID:
                rc = parse_nid(buf, value, quiet);
                break;
        case CLASS_PARSE_NET:
                rc = parse_net(buf, value);
                break;
+       default:
+               LBUG();
        }
        *endp = tmp;
        if (rc != 0)
index d603e5e..47c77b7 100644 (file)
@@ -460,8 +460,6 @@ LUSTRE_RW_ATTR(threads_max);
 static const char *nrs_state2str(enum ptlrpc_nrs_pol_state state)
 {
        switch (state) {
-       default:
-               LBUG();
        case NRS_POL_STATE_INVALID:
                return "invalid";
        case NRS_POL_STATE_STOPPED:
@@ -472,6 +470,9 @@ static const char *nrs_state2str(enum ptlrpc_nrs_pol_state state)
                return "starting";
        case NRS_POL_STATE_STARTED:
                return "started";
+       default:
+               LBUG();
+               return NULL;
        }
 }
 
index b30f805..5ce91c0 100644 (file)
@@ -1668,14 +1668,14 @@ LDEBUGFS_SEQ_FOPS(ptlrpc_lprocfs_nrs_orr_offset_type);
 static const char *nrs_orr_supp2str(enum nrs_orr_supp supp)
 {
        switch(supp) {
-       default:
-               LBUG();
        case NOS_OST_READ:
                return LPROCFS_NRS_SUPP_NAME_READS;
        case NOS_OST_WRITE:
                return LPROCFS_NRS_SUPP_NAME_WRITES;
        case NOS_OST_RW:
                return LPROCFS_NRS_SUPP_NAME_READWRITES;
+       default:
+               LBUG();
        }
 }
 
index 34361df..5c70df6 100644 (file)
@@ -1104,6 +1104,7 @@ static int do_cli_unwrap_reply(struct ptlrpc_request *req)
        case 1:
                req_capsule_set_rep_swabbed(&req->rq_pill,
                                            MSG_PTLRPC_HEADER_OFF);
+               break;
        case 0:
                break;
        default:
@@ -2385,6 +2386,7 @@ int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req)
        case 1:
                req_capsule_set_req_swabbed(&req->rq_pill,
                                            MSG_PTLRPC_HEADER_OFF);
+               break;
        case 0:
                break;
        default: