Whamcloud - gitweb
LU-15220 lnet: use 'fallthrough' pseudo keyword for switch
authorJian Yu <yujian@whamcloud.com>
Sun, 23 Jan 2022 09:21:13 +0000 (01:21 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 24 Jan 2022 05:41:39 +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/45566
Lustre-commit: TBD (from 17563df10b6c2dd1ebc451e9df8d3b8ffc6063a9)

Test-Parameters: trivial
Change-Id: Icace4c9953950f86d3c48068d8c6bba7dd1160a5
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46274
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lnet/include/lnet/lib-lnet.h
lnet/klnds/gnilnd/gnilnd_cb.c
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/o2iblnd/o2iblnd_cb.c
lnet/klnds/socklnd/socklnd.c
lnet/lnet/lib-move.c
lnet/lnet/net_fault.c
lnet/selftest/conctl.c
lnet/selftest/module.c
lnet/selftest/rpc.c

index 7f23d63..98b5e83 100644 (file)
@@ -110,6 +110,10 @@ extern struct lnet the_lnet;                       /* THE network */
 #define in_dev_for_each_ifa_rcu(ifa, in_dev)   for_ifa((in_dev))
 #endif
 
+#ifndef fallthrough
+#define fallthrough do {} while (0)  /* fallthrough */
+#endif
+
 int choose_ipv4_src(__u32 *ret,
                    int interface, __u32 dst_ipaddr, struct net *ns);
 
index 5f838b1..1a4c873 100644 (file)
@@ -876,7 +876,7 @@ kgnilnd_verify_rdma_cksum(kgn_tx_t *tx, __u16 rx_cksum, int put_len)
                                kgnilnd_dump_blob(D_BUFFS, "RDMA payload",
                                                  tx->tx_buffer, nob);
                        }
-                       /* fallthrough */
+                       fallthrough;
                case 1:
                        libcfs_debug_dumplog();
                        break;
@@ -1663,11 +1663,11 @@ kgnilnd_queue_tx(kgn_conn_t *conn, kgn_tx_t *tx)
                        break;
                }
                /* needs to queue to try again, so... */
-               /* fall through... */
+               fallthrough;
        case GNILND_MSG_NOOP:
                /* Just make sure this goes out first for this conn */
                add_tail = 0;
-               /* fall through... */
+               fallthrough;
        default:
                spin_lock(&conn->gnc_list_lock);
                kgnilnd_tx_add_state_locked(tx, conn->gnc_peer, conn, GNILND_TX_FMAQ, add_tail);
@@ -2403,7 +2403,7 @@ kgnilnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg,
                                case 2:
                                        kgnilnd_dump_blob(D_BUFFS, "bad payload checksum",
                                                          &rxmsg[1], rxmsg->gnm_payload_len);
-                                       /* fallthrough */
+                                       fallthrough;
                                case 1:
                                        libcfs_debug_dumplog();
                                        break;
@@ -3738,7 +3738,7 @@ kgnilnd_process_fmaq(kgn_conn_t *conn)
        case GNILND_MSG_PUT_REQ:
        case GNILND_MSG_GET_REQ_REV:
                tx->tx_msg.gnm_u.putreq.gnprm_cookie = tx->tx_id.txe_cookie;
-               /* fallthrough */
+               fallthrough;
        case GNILND_MSG_PUT_ACK:
        case GNILND_MSG_PUT_REQ_REV:
        case GNILND_MSG_GET_ACK_REV:
index b63f75e..013da49 100644 (file)
@@ -3009,7 +3009,7 @@ kiblnd_base_shutdown(void)
                                       !atomic_read(&kiblnd_data.kib_nthreads),
                                       "Waiting for %d threads to terminate\n",
                                       atomic_read(&kiblnd_data.kib_nthreads));
-               /* fall through */
+               fallthrough;
 
         case IBLND_INIT_NOTHING:
                 break;
@@ -3077,7 +3077,7 @@ kiblnd_shutdown(struct lnet_ni *ni)
                                       "%s: waiting for %d conns to clean\n",
                                       libcfs_nid2str(ni->ni_nid),
                                       atomic_read(&net->ibn_nconns));
-               /* fall through */
+               fallthrough;
 
         case IBLND_INIT_NOTHING:
                LASSERT (atomic_read(&net->ibn_nconns) == 0);
index 320d482..9a518ab 100644 (file)
@@ -2948,7 +2948,7 @@ kiblnd_rejected(struct kib_conn *conn, int reason, void *priv, int priv_nob)
                         }
                         break;
                 }
-                /* fall through */
+               fallthrough;
         default:
                 CNETERR("%s rejected: reason %d, size %d\n",
                         libcfs_nid2str(peer_ni->ibp_nid), reason, priv_nob);
index ab36a4e..36be0cc 100644 (file)
@@ -2050,7 +2050,7 @@ ksocknal_base_shutdown(void)
        switch (ksocknal_data.ksnd_init) {
        default:
                LASSERT(0);
-               /* fallthrough */
+               fallthrough;
 
        case SOCKNAL_INIT_ALL:
        case SOCKNAL_INIT_DATA:
index fbe96a7..799ea5a 100644 (file)
@@ -3829,7 +3829,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 */
+               fallthrough;
        case LNET_EVENT_REPLY:
                lnet_handle_recovery_reply(ev_info, event->status, false,
                                           event->type == LNET_EVENT_UNLINK);
@@ -4032,7 +4032,7 @@ lnet_parse_put(struct lnet_ni *ni, struct lnet_msg *msg)
                        ready_delay = true;
                        goto again;
                }
-               /* fall through */
+               fallthrough;
 
        case LNET_MATCHMD_DROP:
                CNETERR("Dropping PUT from %s portal %d match %llu"
index 2fb5b9f..eca096e 100644 (file)
@@ -715,7 +715,7 @@ delayed_msg_process(struct list_head *msg_list, bool drop)
                        case LNET_CREDIT_OK:
                                lnet_ni_recv(ni, msg->msg_private, msg, 0,
                                             0, msg->msg_len, msg->msg_len);
-                               /* fallthrough */
+                               fallthrough;
                        case LNET_CREDIT_WAIT:
                                continue;
                        default: /* failures */
index 7ce53bb..189435b 100644 (file)
@@ -150,7 +150,7 @@ lst_debug_ioctl(struct lstio_debug_args *args)
 
        case LST_OPC_BATCHSRV:
                client = 0;
-               /* fallthrough */
+               fallthrough;
        case LST_OPC_BATCHCLI:
                if (name == NULL)
                        goto out;
index 9d77563..64cb935 100644 (file)
@@ -57,13 +57,13 @@ lnet_selftest_exit(void)
        switch (lst_init_step) {
        case LST_INIT_CONSOLE:
                lstcon_console_fini();
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_FW:
                sfw_shutdown();
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_RPC:
                srpc_shutdown();
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_WI_TEST:
                for (i = 0;
                     i < cfs_cpt_number(lnet_cpt_table()); i++) {
@@ -74,11 +74,11 @@ lnet_selftest_exit(void)
                CFS_FREE_PTR_ARRAY(lst_sched_test,
                                   cfs_cpt_number(lnet_cpt_table()));
                lst_sched_test = NULL;
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_WI_SERIAL:
                cfs_wi_sched_destroy(lst_sched_serial);
                lst_sched_serial = NULL;
-               /* fallthrough */
+               fallthrough;
        case LST_INIT_NONE:
                break;
        default:
index 6221b3d..39321ed 100644 (file)
@@ -986,7 +986,7 @@ static int srpc_handle_rpc(struct swi_workitem *wi)
        switch (wi->swi_state) {
        default:
                LBUG();
-               /* fallthrough */
+               fallthrough;
        case SWI_STATE_NEWBORN: {
                struct srpc_msg *msg;
                struct srpc_generic_reply *reply;
@@ -1028,7 +1028,7 @@ static int srpc_handle_rpc(struct swi_workitem *wi)
                        ev->ev_status = rc;
                }
        }
-       /* fallthrough */
+       fallthrough;
        case SWI_STATE_BULK_STARTED:
                LASSERT(rpc->srpc_bulk == NULL || ev->ev_fired);
 
@@ -1228,7 +1228,7 @@ srpc_send_rpc(struct swi_workitem *wi)
                        break;
 
                wi->swi_state = SWI_STATE_REQUEST_SENT;
-               /* fallthrough */
+               fallthrough;
        case SWI_STATE_REQUEST_SENT: {
                enum srpc_msg_type type;
 
@@ -1262,7 +1262,7 @@ srpc_send_rpc(struct swi_workitem *wi)
 
                wi->swi_state = SWI_STATE_REPLY_RECEIVED;
        }
-       /* fallthrough */
+       fallthrough;
        case SWI_STATE_REPLY_RECEIVED:
                if (do_bulk && !rpc->crpc_bulkev.ev_fired)
                        break;
@@ -1436,14 +1436,14 @@ srpc_lnet_ev_handler(struct lnet_event *ev)
                CERROR("Unknown event: status %d, type %d, lnet %d\n",
                       rpcev->ev_status, rpcev->ev_type, rpcev->ev_lnet);
                LBUG();
-               /* fallthrough */
+               fallthrough;
        case SRPC_REQUEST_SENT:
                if (ev->status == 0 && ev->type != LNET_EVENT_UNLINK) {
                        spin_lock(&srpc_data.rpc_glock);
                        srpc_data.rpc_counters.rpcs_sent++;
                        spin_unlock(&srpc_data.rpc_glock);
                }
-               /* fallthrough */
+               fallthrough;
        case SRPC_REPLY_RCVD:
        case SRPC_BULK_REQ_RCVD:
                crpc = rpcev->ev_data;
@@ -1566,7 +1566,7 @@ srpc_lnet_ev_handler(struct lnet_event *ev)
 
                if (!ev->unlinked)
                        break; /* wait for final event */
-               /* fallthrough */
+               fallthrough;
        case SRPC_BULK_PUT_SENT:
                if (ev->status == 0 && ev->type != LNET_EVENT_UNLINK) {
                        spin_lock(&srpc_data.rpc_glock);
@@ -1578,7 +1578,7 @@ srpc_lnet_ev_handler(struct lnet_event *ev)
 
                        spin_unlock(&srpc_data.rpc_glock);
                }
-               /* fallthrough */
+               fallthrough;
        case SRPC_REPLY_SENT:
                srpc = rpcev->ev_data;
                scd  = srpc->srpc_scd;
@@ -1652,7 +1652,7 @@ srpc_shutdown (void)
        switch (state) {
        default:
                LBUG();
-               /* fallthrough */
+               fallthrough;
        case SRPC_STATE_RUNNING:
                spin_lock(&srpc_data.rpc_glock);
 
@@ -1667,14 +1667,14 @@ srpc_shutdown (void)
                spin_unlock(&srpc_data.rpc_glock);
 
                stt_shutdown();
-               /* fallthrough */
+               fallthrough;
 
        case SRPC_STATE_EQ_INIT:
                rc = LNetClearLazyPortal(SRPC_FRAMEWORK_REQUEST_PORTAL);
                rc = LNetClearLazyPortal(SRPC_REQUEST_PORTAL);
                LASSERT(rc == 0);
                lnet_assert_handler_unused(srpc_data.rpc_lnet_handler);
-               /* fallthrough */
+               fallthrough;
 
        case SRPC_STATE_NI_INIT:
                LNetNIFini();