Whamcloud - gitweb
LU-15220 lustre: use 'fallthrough' pseudo keyword for switch
authorJian Yu <yujian@whamcloud.com>
Sun, 23 Jan 2022 10:19:46 +0000 (02:19 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 24 Jan 2022 05:41:55 +0000 (05:41 +0000)
'/* fallthrough */' hits implicit-fallthrough error with GCC 11.

This patch replaces the existing '/* fallthrough */' comments and
its variants with the 'fallthrough' pseudo keyword, which was added
by Linux kernel commit v5.4-rc2-141-g294f69e662d1.

Lustre-change: https://review.whamcloud.com/46269
Lustre-commit: TBD (from e08dd4bdd1711efd1c3410fbfc39af55b94e18b9)

Test-Parameters: trivial
Change-Id: Icace4c9953950f86d3c48068d8c6bba7dd1160a6
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46275
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
21 files changed:
lustre/include/lustre_compat.h
lustre/ldlm/ldlm_request.c
lustre/lfsck/lfsck_layout.c
lustre/lfsck/lfsck_namespace.c
lustre/llite/file.c
lustre/llite/namei.c
lustre/llite/pcc.c
lustre/lod/lod_object.c
lustre/lod/lod_qos.c
lustre/lov/lov_object.c
lustre/mdt/mdt_coordinator.c
lustre/mdt/mdt_handler.c
lustre/mgs/mgs_barrier.c
lustre/mgs/mgs_llog.c
lustre/obdecho/echo_client.c
lustre/osc/osc_cache.c
lustre/osd-zfs/osd_object.c
lustre/ptlrpc/gss/gss_keyring.c
lustre/ptlrpc/gss/sec_gss.c
lustre/ptlrpc/pack_generic.c
lustre/quota/qmt_handler.c

index 0127f92..c957436 100644 (file)
@@ -581,6 +581,10 @@ static inline int ll_vfs_removexattr(struct dentry *dentry, struct inode *inode,
 #define raw_cpu_ptr(p) __this_cpu_ptr(p)
 #endif
 
+#ifndef fallthrough
+#define fallthrough do {} while (0)  /* fallthrough */
+#endif
+
 static inline void ll_security_release_secctx(char *secdata, u32 seclen)
 {
 #ifdef HAVE_SEC_RELEASE_SECCTX_1ARG
index 05878b9..6ac00de 100644 (file)
@@ -1664,7 +1664,7 @@ ldlm_cancel_no_wait_policy(struct ldlm_namespace *ns, struct ldlm_lock *lock,
                case LDLM_IBITS:
                        if (ns->ns_cancel != NULL && ns->ns_cancel(lock) != 0)
                                break;
-                       /* fallthrough */
+                       fallthrough;
                default:
                        result = LDLM_POLICY_SKIP_LOCK;
                        break;
index b3a9d22..699ce9d 100644 (file)
@@ -6975,7 +6975,7 @@ int lfsck_layout_setup(const struct lu_env *env, struct lfsck_instance *lfsck)
        default:
                CERROR("%s: unknown lfsck_layout status %d\n",
                       lfsck_lfsck2name(lfsck), lo->ll_status);
-               /* fall through */
+               fallthrough;
        case LS_SCANNING_PHASE1:
        case LS_SCANNING_PHASE2:
                /* No need to store the status to disk right now.
@@ -6984,7 +6984,7 @@ int lfsck_layout_setup(const struct lu_env *env, struct lfsck_instance *lfsck)
                lo->ll_status = LS_CRASHED;
                if (!lfsck->li_master)
                        lo->ll_flags |= LF_INCOMPLETE;
-               /* fall through */
+               fallthrough;
        case LS_PAUSED:
        case LS_CRASHED:
        case LS_CO_FAILED:
index 05538e5..098ab8c 100644 (file)
@@ -3778,7 +3778,7 @@ static int lfsck_namespace_double_scan_one(const struct lu_env *env,
 
                        repaired = true;
 
-                       /* fall through */
+                       /* fallthrough */
                }
 
                parent = lfsck_object_find_bottom(env, lfsck, pfid);
@@ -7141,14 +7141,14 @@ int lfsck_namespace_setup(const struct lu_env *env,
        default:
                CERROR("%s: unknown lfsck_namespace status %d\n",
                       lfsck_lfsck2name(lfsck), ns->ln_status);
-               /* fall through */
+               fallthrough;
        case LS_SCANNING_PHASE1:
        case LS_SCANNING_PHASE2:
                /* No need to store the status to disk right now.
                 * If the system crashed before the status stored,
                 * it will be loaded back when next time. */
                ns->ln_status = LS_CRASHED;
-               /* fall through */
+               fallthrough;
        case LS_PAUSED:
        case LS_CRASHED:
                spin_lock(&lfsck->li_lock);
index 6d924ca..952728e 100644 (file)
@@ -164,7 +164,7 @@ static int ll_close_inode_openhandle(struct inode *inode,
                op_data->op_attr_blocks += ((struct inode *)data)->i_blocks;
                op_data->op_attr.ia_valid |= ATTR_SIZE;
                op_data->op_xvalid |= OP_XVALID_BLOCKS;
-               /* fallthrough */
+               fallthrough;
        case MDS_CLOSE_LAYOUT_SPLIT:
        case MDS_CLOSE_LAYOUT_SWAP: {
                struct split_param *sp = data;
@@ -3329,7 +3329,7 @@ static int ll_ladvise_sanity(struct inode *inode,
                               ladvise_names[advice], rc);
                        GOTO(out, rc);
                }
-               /* fallthrough */
+               fallthrough;
        case LU_LADVISE_WILLREAD:
        case LU_LADVISE_DONTNEED:
        default:
index 314db74..a10a94e 100644 (file)
@@ -410,13 +410,13 @@ int ll_md_need_convert(struct ldlm_lock *lock)
        switch (lock->l_req_mode) {
        case LCK_PR:
                mode = LCK_PR;
-               /* fallthrough */
+               fallthrough;
        case LCK_PW:
                mode |= LCK_CR;
                break;
        case LCK_CW:
                mode = LCK_CW;
-               /* fallthrough */
+               fallthrough;
        case LCK_CR:
                mode |= LCK_CR;
                break;
@@ -1697,7 +1697,7 @@ static int ll_mknod(struct inode *dir, struct dentry *dchild, umode_t mode,
        switch (mode & S_IFMT) {
        case 0:
                mode |= S_IFREG;
-               /* fallthrough */
+               fallthrough;
        case S_IFREG:
        case S_IFCHR:
        case S_IFBLK:
index 1132976..e3aa91e 100644 (file)
@@ -417,11 +417,11 @@ static int pcc_expr_time_parse(char *str, int len, struct pcc_expression *expr)
        rc = strspn(buf, "0123456789");
        if (rc < len) {
                switch(str[rc]) {
-               case 'y': mult *= 52;   /* fallthrough */
-               case 'w': mult *= 7;    /* fallthrough */
-               case 'd': mult *= 24;   /* fallthrough */
-               case 'h': mult *= 60;   /* fallthrough */
-               case 'm': mult *= 60;   /* fallthrough */
+               case 'y': mult *= 52;   fallthrough;
+               case 'w': mult *= 7;    fallthrough;
+               case 'd': mult *= 24;   fallthrough;
+               case 'h': mult *= 60;   fallthrough;
+               case 'm': mult *= 60;   fallthrough;
                case 's': break;
                default: return -EINVAL;
                }
index 8dafe46..444d4d1 100644 (file)
@@ -3676,7 +3676,7 @@ static int lod_xattr_set_lov_on_dir(const struct lu_env *env,
                v3 = buf->lb_buf;
                if (v3->lmm_pool_name[0] != '\0')
                        pool_name = v3->lmm_pool_name;
-               /* fall through */
+               fallthrough;
        case LOV_USER_MAGIC_V1:
                /* if { size, offset, count } = { 0, -1, 0 } and no pool
                 * (i.e. all default values specified) then delete default
index 91f1fd6..c5a9f39 100644 (file)
@@ -2171,13 +2171,13 @@ int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo,
        case __swab32(LOV_USER_MAGIC_V1):
                lustre_swab_lov_user_md_v1(v1);
                magic = v1->lmm_magic;
-               /* fall through */
+               fallthrough;
        case LOV_USER_MAGIC_V1:
                break;
        case __swab32(LOV_USER_MAGIC_V3):
                lustre_swab_lov_user_md_v3(v3);
                magic = v3->lmm_magic;
-               /* fall through */
+               fallthrough;
        case LOV_USER_MAGIC_V3:
                break;
        case __swab32(LOV_USER_MAGIC_SPECIFIC):
@@ -2185,13 +2185,13 @@ int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo,
                lustre_swab_lov_user_md_objects(v3->lmm_objects,
                                                v3->lmm_stripe_count);
                magic = v3->lmm_magic;
-               /* fall through */
+               fallthrough;
        case LOV_USER_MAGIC_SPECIFIC:
                break;
        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):
@@ -2201,7 +2201,7 @@ int lod_qos_parse_config(const struct lu_env *env, struct lod_object *lo,
                __swab32s(&lfm->lfm_type);
                __swab32s(&lfm->lfm_flags);
                magic = lfm->lfm_magic;
-               /* fall through */
+               fallthrough;
        case LOV_USER_MAGIC_FOREIGN:
                if (!lfm)
                        lfm = buf->lb_buf;
index 2b1cf0a..7f5bb10 100644 (file)
@@ -2320,9 +2320,9 @@ int lov_read_and_clear_async_rc(struct cl_object *clob)
                                }
                        }
                }
+               fallthrough;
                case LLT_RELEASED:
                case LLT_EMPTY:
-                       /* fall through */
                case LLT_FOREIGN:
                        break;
                default:
index 6c5eae7..dd1ec8a 100644 (file)
@@ -296,7 +296,7 @@ static int mdt_cdt_waiting_cb(const struct lu_env *env,
                break;
        case HSMA_RESTORE:
                hsd->hsd_one_restore = true;
-               /* Intentional fallthrough */
+               fallthrough;
        default:
                cdt_agent_record_hash_add(cdt, hai->hai_cookie,
                                          llh->lgh_hdr->llh_cat_idx,
index 39c78c0..954bac5 100644 (file)
@@ -3054,7 +3054,7 @@ static int mdt_quotactl(struct tgt_session_info *tsi)
                if (!nodemap_can_setquota(nodemap, oqctl->qc_type,
                                          oqctl->qc_id))
                        GOTO(out_nodemap, rc = -EPERM);
-               /* fallthrough */
+               fallthrough;
        case Q_GETINFO:
        case Q_GETQUOTA:
        case LUSTRE_Q_GETDEFAULT:
@@ -3064,7 +3064,7 @@ static int mdt_quotactl(struct tgt_session_info *tsi)
                if (qmt == NULL)
                        GOTO(out_nodemap, rc = -EOPNOTSUPP);
                /* slave quotactl */
-               /* fallthrough */
+               fallthrough;
        case Q_GETOINFO:
        case Q_GETOQUOTA:
                break;
@@ -4715,7 +4715,7 @@ static int mdt_intent_opc(enum ldlm_intent_flags it_opc,
                break;
        case IT_GETATTR:
                check_mdt_object = true;
-               /* fallthrough */
+               fallthrough;
        case IT_LOOKUP:
                it_format = &RQF_LDLM_INTENT_GETATTR;
                it_handler = &mdt_intent_getattr;
index 053f41d..445db9f 100644 (file)
@@ -358,7 +358,7 @@ static int mgs_barrier_freeze(const struct lu_env *env,
                        rc = -EALREADY;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case BS_INIT:
        case BS_THAWED:
        case BS_EXPIRED:
@@ -684,7 +684,7 @@ static int mgs_barrier_rescan(const struct lu_env *env,
                        rc = -EBUSY;
                        break;
                }
-               /* fallthrough */
+               fallthrough;
        case BS_INIT:
        case BS_THAWED:
        case BS_EXPIRED:
index 6466af2..6590a0d 100644 (file)
@@ -4719,7 +4719,7 @@ static int mgs_lcfg_fork_handler(const struct lu_env *env,
                        } /* else case fall through */
                } /* else case fall through */
        }
-       /* fallthrough */
+       fallthrough;
        default: {
                for (i = 1; i < cnt; i++) {
                        o_buflen = o_lcfg->lcfg_buflens[i];
index 820cd22..5959319 100644 (file)
@@ -1006,17 +1006,17 @@ out:
                        CERROR("Cleanup obd device %s error(%d)\n",
                               obd->obd_name, rc2);
        }
-       /* fallthrough */
+       fallthrough;
 
        case 3:
                echo_site_fini(env, ed);
-               /* fallthrough */
+               fallthrough;
        case 2:
                cl_device_fini(&ed->ed_cl);
-               /* fallthrough */
+               fallthrough;
        case 1:
                OBD_FREE_PTR(ed);
-               /* fallthrough */
+               fallthrough;
        case 0:
        default:
                break;
@@ -2765,7 +2765,7 @@ static int echo_client_brw_ioctl(const struct lu_env *env, int rw,
 
        switch (test_mode) {
        case 1:
-               /* fall through */
+               fallthrough;
        case 2:
                rc = echo_client_kbrw(ed, rw, oa, eco, data->ioc_offset,
                                      data->ioc_count, async);
@@ -2938,7 +2938,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                        GOTO(out, rc = -EPERM);
 
                rw = OBD_BRW_WRITE;
-               /* fall through */
+               fallthrough;
        case OBD_IOC_BRW_READ:
                rc = echo_client_brw_ioctl(env, rw, exp, data);
                GOTO(out, rc);
index 7cd1f56..a8fc476 100644 (file)
@@ -212,7 +212,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext,
                        GOTO(out, rc = 60);
                if (ext->oe_fsync_wait && !ext->oe_urgent && !ext->oe_hp)
                        GOTO(out, rc = 65);
-               /* fallthrough */
+               fallthrough;
        default:
                if (atomic_read(&ext->oe_users) > 0)
                        GOTO(out, rc = 70);
index dc0d4d5..c037708 100644 (file)
@@ -1499,7 +1499,7 @@ static int osd_declare_create(const struct lu_env *env, struct dt_object *dt,
        switch (dof->dof_type) {
                case DFT_DIR:
                        dt->do_index_ops = &osd_dir_ops;
-                       /* fallthrough */
+                       fallthrough;
                case DFT_INDEX:
                        /* for zap create */
                        dmu_tx_hold_zap(oh->ot_tx, DMU_NEW_OBJECT, FALSE, NULL);
index 553db03..6b37a89 100644 (file)
@@ -692,24 +692,24 @@ static void request_key_unlink(struct key *key)
                                break;
                }
 #endif
-               /* fall through */
+               fallthrough;
        case KEY_REQKEY_DEFL_THREAD_KEYRING:
                ring = key_get(cred->thread_keyring);
                if (ring)
                        break;
-               /* fallthrough */
+               fallthrough;
        case KEY_REQKEY_DEFL_PROCESS_KEYRING:
                ring = key_get(cred->process_keyring);
                if (ring)
                        break;
-               /* fallthrough */
+               fallthrough;
        case KEY_REQKEY_DEFL_SESSION_KEYRING:
                rcu_read_lock();
                ring = key_get(rcu_dereference(cred->session_keyring));
                rcu_read_unlock();
                if (ring)
                        break;
-               /* fallthrough */
+               fallthrough;
        case KEY_REQKEY_DEFL_USER_SESSION_KEYRING:
                ring = get_user_session_keyring(cred);
                break;
index 6f6a978..3fb6adf 100644 (file)
@@ -534,7 +534,7 @@ int gss_check_seq_num(struct gss_svc_seq_data *ssd, __u32 seq_num, int set)
                 switch (rc) {
                 case -1:
                         gss_stat_oos_record_svc(1, 1);
-                        /* fall through */
+                       fallthrough;
                 case 0:
                         goto exit;
                 }
index 9322ead..3b11d89 100644 (file)
@@ -890,7 +890,7 @@ __u32 lustre_msg_get_flags(struct lustre_msg *msg)
 
                CERROR("invalid msg %p: no ptlrpc body!\n", msg);
        }
-       /* fallthrough */
+       fallthrough;
        default:
                /*
                 * flags might be printed in debug code while message
@@ -956,7 +956,7 @@ __u32 lustre_msg_get_op_flags(struct lustre_msg *msg)
 
                CERROR("invalid msg %p: no ptlrpc body!\n", msg);
        }
-       /* fallthrough */
+       fallthrough;
        default:
                return 0;
        }
@@ -1161,7 +1161,7 @@ int lustre_msg_get_status(struct lustre_msg *msg)
                        return pb->pb_status;
                CERROR("invalid msg %p: no ptlrpc body!\n", msg);
        }
-       /* fallthrough */
+       fallthrough;
        default:
                /*
                 * status might be printed in debug code while message
@@ -2275,7 +2275,7 @@ void lustre_swab_lmv_user_md(struct lmv_user_md *lum)
        switch (lum->lum_magic) {
        case LMV_USER_MAGIC_SPECIFIC:
                count = lum->lum_stripe_count;
-               /* fallthrough */
+               fallthrough;
        case __swab32(LMV_USER_MAGIC_SPECIFIC):
                lustre_swab_lmv_user_md_objects(lum->lum_objects, count);
                break;
index 166dc30..3bdd3e9 100644 (file)
@@ -410,7 +410,7 @@ static int qmt_quotactl(const struct lu_env *env, struct lu_device *ld,
        case LUSTRE_Q_GETDEFAULT:
        case LUSTRE_Q_GETDEFAULT_POOL:
                is_default = true;
-               /* fallthrough */
+               fallthrough;
 
        case Q_GETQUOTA: /* consult quota limit */
        case LUSTRE_Q_GETQUOTAPOOL:
@@ -445,7 +445,7 @@ static int qmt_quotactl(const struct lu_env *env, struct lu_device *ld,
        case LUSTRE_Q_SETDEFAULT:
        case LUSTRE_Q_SETDEFAULT_POOL:
                is_default = true;
-               /* fallthrough */
+               fallthrough;
 
        case Q_SETQUOTA: /* change quota limits */
        case LUSTRE_Q_SETQUOTAPOOL: