From 5549b1b9e032c6eae63c9bde7104769697b93a0f Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Sat, 22 Jan 2022 18:21:04 -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. Test-Parameters: trivial Change-Id: Icace4c9953950f86d3c48068d8c6bba7dd1160a6 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/46269 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Peter Jones --- 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/dir.c | 2 -- lustre/llite/file.c | 6 ++---- lustre/llite/llite_lib.c | 4 ++-- lustre/llite/namei.c | 6 +++--- lustre/lod/lod_object.c | 2 +- lustre/lod/lod_qos.c | 8 ++++---- 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/lproc_ptlrpc.c | 1 + lustre/ptlrpc/pack_generic.c | 8 ++++---- lustre/quota/qmt_handler.c | 4 ++-- 23 files changed, 50 insertions(+), 49 deletions(-) diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index f4ba40e..ccd0960 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -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 diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index cee372d..048f5c3 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -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; diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index e11968ef..30d0c82 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -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: diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index e954edf..1dd801f 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); @@ -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); diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 36edab3..7aaa059 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -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: diff --git a/lustre/llite/file.c b/lustre/llite/file.c index c06583f..3a8fa24 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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: { diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index e11d023..21bac82 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -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; } diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 8dfe6141..7ca34c1 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -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: diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 6eb3b2f..982ccec 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -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 diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 4a46796..7d00452 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -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; diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index f8a7522..870a592 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -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: diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 767af80..0ff12de 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 7f721b8..b6de915 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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; diff --git a/lustre/mgs/mgs_barrier.c b/lustre/mgs/mgs_barrier.c index 9087055..c419421 100644 --- a/lustre/mgs/mgs_barrier.c +++ b/lustre/mgs/mgs_barrier.c @@ -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: diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 3960f9e..c276563 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -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]; diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 500358c..8dca248 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -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); diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 565b8ef..4d2e1c8 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -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); diff --git a/lustre/osd-zfs/osd_object.c b/lustre/osd-zfs/osd_object.c index 34dfae4..8b1310c 100644 --- a/lustre/osd-zfs/osd_object.c +++ b/lustre/osd-zfs/osd_object.c @@ -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); diff --git a/lustre/ptlrpc/gss/gss_keyring.c b/lustre/ptlrpc/gss/gss_keyring.c index 28c4a38..124ebe1 100644 --- a/lustre/ptlrpc/gss/gss_keyring.c +++ b/lustre/ptlrpc/gss/gss_keyring.c @@ -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; diff --git a/lustre/ptlrpc/gss/sec_gss.c b/lustre/ptlrpc/gss/sec_gss.c index 86e13e6..7c80011 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/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 7141d97..bfb48d6 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -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)); diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 034113a..e3c0f47 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -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; diff --git a/lustre/quota/qmt_handler.c b/lustre/quota/qmt_handler.c index 718fbdf..c355da2 100644 --- a/lustre/quota/qmt_handler.c +++ b/lustre/quota/qmt_handler.c @@ -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: -- 1.8.3.1