Whamcloud - gitweb
LU-15220 lustre: use 'fallthrough' pseudo keyword for switch 69/46269/3
authorJian Yu <yujian@whamcloud.com>
Sun, 23 Jan 2022 02:21:04 +0000 (18:21 -0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Jan 2022 05:17:26 +0000 (05:17 +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.

Test-Parameters: trivial
Change-Id: Icace4c9953950f86d3c48068d8c6bba7dd1160a6
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46269
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: Peter Jones <pjones@whamcloud.com>
23 files changed:
lustre/include/lustre_compat.h
lustre/ldlm/ldlm_request.c
lustre/lfsck/lfsck_layout.c
lustre/lfsck/lfsck_namespace.c
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/llite_lib.c
lustre/llite/namei.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/lproc_ptlrpc.c
lustre/ptlrpc/pack_generic.c
lustre/quota/qmt_handler.c

index f4ba40e..ccd0960 100644 (file)
@@ -599,6 +599,10 @@ static inline bool is_root_inode(struct inode *inode)
 #define register_shrinker(_s) (register_shrinker(_s), 0)
 #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 cee372d..048f5c3 100644 (file)
@@ -1665,7 +1665,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 e11968e..30d0c82 100644 (file)
@@ -7018,7 +7018,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.
@@ -7027,7 +7027,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 e954edf..1dd801f 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);
@@ -7152,14 +7152,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 36edab3..7aaa059 100644 (file)
@@ -2004,9 +2004,7 @@ out_quotactl:
                RETURN(rc);
         }
        case OBD_IOC_GETNAME_OLD:
-               /* fall through */
        case OBD_IOC_GETDTNAME:
-               /* fall through */
        case OBD_IOC_GETMDNAME:
                 RETURN(ll_get_obd_name(inode, cmd, arg));
         case LL_IOC_FLUSHCTX:
index c06583f..3a8fa24 100644 (file)
@@ -172,7 +172,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;
@@ -3348,7 +3348,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:
@@ -4039,9 +4039,7 @@ out:
                 RETURN(0);
         }
        case OBD_IOC_GETNAME_OLD:
-               /* fall through */
        case OBD_IOC_GETDTNAME:
-               /* fall through */
        case OBD_IOC_GETMDNAME:
                RETURN(ll_get_obd_name(inode, cmd, arg));
        case LL_IOC_HSM_STATE_GET: {
index e11d023..21bac82 100644 (file)
@@ -1054,7 +1054,7 @@ static int ll_options(char *options, struct super_block *sb)
 
                case LL_SBI_CHECKSUM:
                        sbi->ll_checksum_set = 1;
-                       /* fall through */
+                       fallthrough;
                case LL_SBI_USER_XATTR:
                case LL_SBI_USER_FID2PATH:
                case LL_SBI_LRU_RESIZE:
@@ -1122,7 +1122,7 @@ static int ll_options(char *options, struct super_block *sb)
                                LCONSOLE_ERROR_MSG(0x152,
                                                   "invalid %s option\n", s1);
                        }
-               /* fall through */
+               fallthrough;
                default:
                        break;
                }
index 8dfe614..7ca34c1 100644 (file)
@@ -423,13 +423,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;
@@ -1795,7 +1795,7 @@ static int ll_mknod(struct user_namespace *mnt_userns, struct inode *dir,
        switch (mode & S_IFMT) {
        case 0:
                mode |= S_IFREG;
-               /* fallthrough */
+               fallthrough;
        case S_IFREG:
        case S_IFCHR:
        case S_IFBLK:
index 6eb3b2f..982ccec 100644 (file)
@@ -3899,7 +3899,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 4a46796..7d00452 100644 (file)
@@ -2168,13 +2168,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):
@@ -2182,7 +2182,7 @@ 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):
@@ -2198,7 +2198,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 f8a7522..870a592 100644 (file)
@@ -2321,9 +2321,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 767af80..0ff12de 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 7f721b8..b6de915 100644 (file)
@@ -3222,7 +3222,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:
@@ -3232,7 +3232,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;
@@ -4836,7 +4836,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 9087055..c419421 100644 (file)
@@ -370,7 +370,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:
@@ -688,7 +688,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 3960f9e..c276563 100644 (file)
@@ -4762,7 +4762,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 500358c..8dca248 100644 (file)
@@ -1004,17 +1004,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;
@@ -2767,7 +2767,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);
@@ -2940,7 +2940,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 565b8ef..4d2e1c8 100644 (file)
@@ -211,7 +211,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 34dfae4..8b1310c 100644 (file)
@@ -1441,7 +1441,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 28c4a38..124ebe1 100644 (file)
@@ -691,24 +691,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 86e13e6..7c80011 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 7141d97..bfb48d6 100644 (file)
@@ -1015,6 +1015,7 @@ void target_print_req(void *seq_file, struct ptlrpc_request *req)
                /* being handled, so basic msg swabbed, and opc is valid
                 * but racing with mds_handle().  fallthrough.
                 */
+               fallthrough;
        case RQ_PHASE_COMPLETE:
                /* been handled by mds_handle(), reply state may be volatile */
                seq_printf(sf, "opc %d\n", lustre_msg_get_opc(req->rq_reqmsg));
index 034113a..e3c0f47 100644 (file)
@@ -889,7 +889,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
@@ -955,7 +955,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;
        }
@@ -1160,7 +1160,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
@@ -2274,7 +2274,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 718fbdf..c355da2 100644 (file)
@@ -420,7 +420,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:
@@ -455,7 +455,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: