Whamcloud - gitweb
LU-12635 build: Support for gcc -Wimplicit-fallthrough 08/35708/4
authorShaun Tancheff <stancheff@cray.com>
Thu, 15 Aug 2019 18:50:01 +0000 (13:50 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 3 Sep 2019 05:11:15 +0000 (05:11 +0000)
Linux 5.3 enables -Wimplicit-fallthrough
Add decorators for implicit-fallthrough compiler checks.

Test-Parameters: trivial
Cray-bug-id: LUS-7690
Signed-off-by: Shaun Tancheff <stancheff@cray.com>
Change-Id: I5bccb2cfd6b5900ff7f0e21b5546eec9ffa83c19
Reviewed-on: https://review.whamcloud.com/35708
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
14 files changed:
lnet/klnds/socklnd/socklnd.c
lnet/lnet/lib-move.c
lustre/ldlm/ldlm_request.c
lustre/llite/file.c
lustre/llite/namei.c
lustre/mdt/mdt_handler.c
lustre/mgs/mgs_barrier.c
lustre/mgs/mgs_llog.c
lustre/obdclass/lprocfs_status.c
lustre/obdecho/echo_client.c
lustre/osc/osc_cache.c
lustre/ptlrpc/gss/gss_keyring.c
lustre/ptlrpc/pack_generic.c
lustre/quota/qmt_handler.c

index 6c38119..cb27e2b 100644 (file)
@@ -2266,16 +2266,16 @@ ksocknal_base_shutdown(void)
               atomic_read (&libcfs_kmemory));
        LASSERT (ksocknal_data.ksnd_nnets == 0);
 
-        switch (ksocknal_data.ksnd_init) {
-        default:
-                LASSERT (0);
-
-        case SOCKNAL_INIT_ALL:
-        case SOCKNAL_INIT_DATA:
-                LASSERT (ksocknal_data.ksnd_peers != NULL);
-                for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) {
+       switch (ksocknal_data.ksnd_init) {
+       default:
+               LASSERT(0);
+               /* fallthrough */
+
+       case SOCKNAL_INIT_ALL:
+       case SOCKNAL_INIT_DATA:
+               LASSERT(ksocknal_data.ksnd_peers != NULL);
+               for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++)
                        LASSERT(list_empty(&ksocknal_data.ksnd_peers[i]));
-                }
 
                LASSERT(list_empty(&ksocknal_data.ksnd_nets));
                LASSERT(list_empty(&ksocknal_data.ksnd_enomem_conns));
index 49941de..e3bad23 100644 (file)
@@ -3699,6 +3699,7 @@ lnet_mt_event_handler(struct lnet_event *event)
        case LNET_EVENT_UNLINK:
                CDEBUG(D_NET, "%s recovery ping unlinked\n",
                       libcfs_nid2str(ev_info->mt_nid));
+               /* fallthrough */
        case LNET_EVENT_REPLY:
                lnet_handle_recovery_reply(ev_info, event->status,
                                           event->type == LNET_EVENT_UNLINK);
index c0f4f2f..e2e194d 100644 (file)
@@ -1729,6 +1729,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 */
                default:
                        result = LDLM_POLICY_SKIP_LOCK;
                        break;
index adf5b6b..81decaf 100644 (file)
@@ -163,6 +163,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 */
        case MDS_CLOSE_LAYOUT_SPLIT:
        case MDS_CLOSE_LAYOUT_SWAP: {
                struct split_param *sp = data;
@@ -3020,6 +3021,7 @@ static int ll_ladvise_sanity(struct inode *inode,
                               ladvise_names[advice], rc);
                        GOTO(out, rc);
                }
+               /* fallthrough */
        case LU_LADVISE_WILLREAD:
        case LU_LADVISE_DONTNEED:
        default:
index 4a412cc..1a73760 100644 (file)
@@ -398,11 +398,13 @@ int ll_md_need_convert(struct ldlm_lock *lock)
        switch (lock->l_req_mode) {
        case LCK_PR:
                mode = LCK_PR;
+               /* fallthrough */
        case LCK_PW:
                mode |= LCK_CR;
                break;
        case LCK_CW:
                mode = LCK_CW;
+               /* fallthrough */
        case LCK_CR:
                mode |= LCK_CR;
                break;
@@ -1449,37 +1451,38 @@ static int ll_mknod(struct inode *dir, struct dentry *dchild, ll_umode_t mode,
 {
        struct qstr *name = &dchild->d_name;
        int err;
-        ENTRY;
+       ENTRY;
 
        CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, dir="DFID"(%p) mode %o dev %x\n",
               name->len, name->name, PFID(ll_inode2fid(dir)), dir,
-               mode, rdev);
+              mode, rdev);
 
        if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
                mode &= ~current_umask();
 
-        switch (mode & S_IFMT) {
-        case 0:
-                mode |= S_IFREG; /* for mode = 0 case, fallthrough */
-        case S_IFREG:
-        case S_IFCHR:
-        case S_IFBLK:
-        case S_IFIFO:
-        case S_IFSOCK:
+       switch (mode & S_IFMT) {
+       case 0:
+               mode |= S_IFREG;
+               /* fallthrough */
+       case S_IFREG:
+       case S_IFCHR:
+       case S_IFBLK:
+       case S_IFIFO:
+       case S_IFSOCK:
                err = ll_new_node(dir, dchild, NULL, mode, old_encode_dev(rdev),
                                  LUSTRE_OPC_MKNOD);
-                break;
-        case S_IFDIR:
-                err = -EPERM;
-                break;
-        default:
-                err = -EINVAL;
-        }
+               break;
+       case S_IFDIR:
+               err = -EPERM;
+               break;
+       default:
+               err = -EINVAL;
+       }
 
-        if (!err)
-                ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKNOD, 1);
+       if (!err)
+               ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKNOD, 1);
 
-        RETURN(err);
+       RETURN(err);
 }
 
 #ifdef HAVE_IOP_ATOMIC_OPEN
index b3f29e1..e08b2d5 100644 (file)
@@ -2704,12 +2704,14 @@ static int mdt_quotactl(struct tgt_session_info *tsi)
        case LUSTRE_Q_SETDEFAULT:
                if (!nodemap_can_setquota(nodemap))
                        GOTO(out_nodemap, rc = -EPERM);
+               /* fallthrough */
        case Q_GETINFO:
        case Q_GETQUOTA:
        case LUSTRE_Q_GETDEFAULT:
                if (qmt == NULL)
                        GOTO(out_nodemap, rc = -EOPNOTSUPP);
                /* slave quotactl */
+               /* fallthrough */
        case Q_GETOINFO:
        case Q_GETOQUOTA:
                break;
index 225bfa9..7ea0915 100644 (file)
@@ -358,6 +358,7 @@ static int mgs_barrier_freeze(const struct lu_env *env,
                        rc = -EALREADY;
                        break;
                }
+               /* fallthrough */
        case BS_INIT:
        case BS_THAWED:
        case BS_EXPIRED:
@@ -683,6 +684,7 @@ static int mgs_barrier_rescan(const struct lu_env *env,
                        rc = -EBUSY;
                        break;
                }
+               /* fallthrough */
        case BS_INIT:
        case BS_THAWED:
        case BS_EXPIRED:
index 2740b2f..841afcd 100644 (file)
@@ -4701,6 +4701,7 @@ static int mgs_lcfg_fork_handler(const struct lu_env *env,
                        } /* else case fall through */
                } /* else case fall through */
        }
+       /* fallthrough */
        default: {
                for (i = 1; i < cnt; i++) {
                        o_buflen = o_lcfg->lcfg_buflens[i];
index 12ade8a..e85e395 100644 (file)
@@ -1781,15 +1781,19 @@ static int get_mult(char unit, __u64 *mult)
        case 'p':
        case 'P':
                units <<= 10;
+               /* fallthrough */
        case 't':
        case 'T':
                units <<= 10;
+               /* fallthrough */
        case 'g':
        case 'G':
                units <<= 10;
+               /* fallthrough */
        case 'm':
        case 'M':
                units <<= 10;
+               /* fallthrough */
        case 'k':
        case 'K':
                units <<= 10;
index 11191fb..1743b51 100644 (file)
@@ -986,13 +986,17 @@ out:
                        CERROR("Cleanup obd device %s error(%d)\n",
                               obd->obd_name, rc2);
        }
+       /* fallthrough */
 
        case 3:
                echo_site_fini(env, ed);
+               /* fallthrough */
        case 2:
                cl_device_fini(&ed->ed_cl);
+               /* fallthrough */
        case 1:
                OBD_FREE_PTR(ed);
+               /* fallthrough */
        case 0:
        default:
                break;
index 431df82..8cf0158 100644 (file)
@@ -220,6 +220,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 */
        default:
                if (atomic_read(&ext->oe_users) > 0)
                        GOTO(out, rc = 70);
index 8d8ab4b..d744262 100644 (file)
@@ -681,10 +681,12 @@ static void request_key_unlink(struct key *key)
                ring = key_get(key_cred(tsk)->thread_keyring);
                if (ring)
                        break;
+               /* fallthrough */
        case KEY_REQKEY_DEFL_PROCESS_KEYRING:
                ring = key_get(key_tgcred(tsk)->process_keyring);
                if (ring)
                        break;
+               /* fallthrough */
        case KEY_REQKEY_DEFL_SESSION_KEYRING:
                rcu_read_lock();
                ring = key_get(rcu_dereference(key_tgcred(tsk)
@@ -692,6 +694,7 @@ static void request_key_unlink(struct key *key)
                rcu_read_unlock();
                if (ring)
                        break;
+               /* fallthrough */
        case KEY_REQKEY_DEFL_USER_SESSION_KEYRING:
                ring = key_get(key_cred(tsk)->user->session_keyring);
                break;
index de9437c..e733648 100644 (file)
@@ -826,7 +826,7 @@ __u32 lustre_msg_get_flags(struct lustre_msg *msg)
 
                CERROR("invalid msg %p: no ptlrpc body!\n", msg);
        }
-       /* no break */
+       /* fallthrough */
        default:
                /* flags might be printed in debug code while message
                 * uninitialized */
@@ -890,7 +890,7 @@ __u32 lustre_msg_get_op_flags(struct lustre_msg *msg)
 
                CERROR("invalid msg %p: no ptlrpc body!\n", msg);
        }
-       /* no break */
+       /* fallthrough */
        default:
                return 0;
        }
@@ -1095,7 +1095,7 @@ int lustre_msg_get_status(struct lustre_msg *msg)
                        return pb->pb_status;
                CERROR("invalid msg %p: no ptlrpc body!\n", msg);
        }
-       /* no break */
+       /* fallthrough */
        default:
                /* status might be printed in debug code while message
                * uninitialized */
@@ -2152,6 +2152,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 */
        case __swab32(LMV_USER_MAGIC_SPECIFIC):
                lustre_swab_lmv_user_md_objects(lum->lum_objects, count);
                break;
index 3e8d7f5..511b7f9 100644 (file)
@@ -348,6 +348,7 @@ static int qmt_quotactl(const struct lu_env *env, struct lu_device *ld,
 
        case LUSTRE_Q_GETDEFAULT:
                is_default = true;
+               /* fallthrough */
 
        case Q_GETQUOTA: /* consult quota limit */
                /* extract quota ID from quotactl request */
@@ -378,6 +379,7 @@ static int qmt_quotactl(const struct lu_env *env, struct lu_device *ld,
 
        case LUSTRE_Q_SETDEFAULT:
                is_default = true;
+               /* fallthrough */
 
        case Q_SETQUOTA: /* change quota limits */
                /* extract quota ID from quotactl request */