From 986d62632a9c381ae9220b18e5401e6990bcbc64 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Sun, 23 Jan 2022 02:19:46 -0800 Subject: [PATCH] LU-15220 lustre: use 'fallthrough' pseudo keyword for switch '/* 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 Reviewed-on: https://review.whamcloud.com/46275 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/include/lustre_compat.h | 4 ++++ lustre/ldlm/ldlm_request.c | 2 +- lustre/lfsck/lfsck_layout.c | 4 ++-- lustre/lfsck/lfsck_namespace.c | 6 +++--- lustre/llite/file.c | 4 ++-- lustre/llite/namei.c | 6 +++--- lustre/llite/pcc.c | 10 +++++----- lustre/lod/lod_object.c | 2 +- lustre/lod/lod_qos.c | 10 +++++----- lustre/lov/lov_object.c | 2 +- lustre/mdt/mdt_coordinator.c | 2 +- lustre/mdt/mdt_handler.c | 6 +++--- lustre/mgs/mgs_barrier.c | 4 ++-- lustre/mgs/mgs_llog.c | 2 +- lustre/obdecho/echo_client.c | 12 ++++++------ lustre/osc/osc_cache.c | 2 +- lustre/osd-zfs/osd_object.c | 2 +- lustre/ptlrpc/gss/gss_keyring.c | 8 ++++---- lustre/ptlrpc/gss/sec_gss.c | 2 +- lustre/ptlrpc/pack_generic.c | 8 ++++---- lustre/quota/qmt_handler.c | 4 ++-- 21 files changed, 53 insertions(+), 49 deletions(-) diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index 0127f92..c957436 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -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 diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 05878b9..6ac00de 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -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; diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index b3a9d22..699ce9d3 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -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: diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 05538e5..098ab8c 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -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); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 6d924ca..952728e 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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: diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 314db74..a10a94e 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -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: diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index 1132976..e3aa91e 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -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; } diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 8dafe46..444d4d1 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -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 diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 91f1fd6..c5a9f39 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -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; diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index 2b1cf0a..7f5bb10 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -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: diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 6c5eae7..dd1ec8a 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -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, diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 39c78c0..954bac57 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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; diff --git a/lustre/mgs/mgs_barrier.c b/lustre/mgs/mgs_barrier.c index 053f41d..445db9f 100644 --- a/lustre/mgs/mgs_barrier.c +++ b/lustre/mgs/mgs_barrier.c @@ -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: diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 6466af2..6590a0d 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -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]; diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 820cd22..5959319 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -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); diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 7cd1f56..a8fc476 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -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); diff --git a/lustre/osd-zfs/osd_object.c b/lustre/osd-zfs/osd_object.c index dc0d4d5..c037708 100644 --- a/lustre/osd-zfs/osd_object.c +++ b/lustre/osd-zfs/osd_object.c @@ -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); diff --git a/lustre/ptlrpc/gss/gss_keyring.c b/lustre/ptlrpc/gss/gss_keyring.c index 553db03..6b37a89 100644 --- a/lustre/ptlrpc/gss/gss_keyring.c +++ b/lustre/ptlrpc/gss/gss_keyring.c @@ -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; diff --git a/lustre/ptlrpc/gss/sec_gss.c b/lustre/ptlrpc/gss/sec_gss.c index 6f6a978..3fb6adf 100644 --- a/lustre/ptlrpc/gss/sec_gss.c +++ b/lustre/ptlrpc/gss/sec_gss.c @@ -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; } diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 9322ead..3b11d89 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -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; diff --git a/lustre/quota/qmt_handler.c b/lustre/quota/qmt_handler.c index 166dc30..3bdd3e9 100644 --- a/lustre/quota/qmt_handler.c +++ b/lustre/quota/qmt_handler.c @@ -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: -- 1.8.3.1