Whamcloud - gitweb
LU-15220 lnet: use 'fallthrough' pseudo keyword for switch 66/45566/12
authorJian Yu <yujian@whamcloud.com>
Thu, 20 Jan 2022 18:19:34 +0000 (10:19 -0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Jan 2022 05:17:18 +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: Icace4c9953950f86d3c48068d8c6bba7dd1160a5
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45566
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
12 files changed:
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/klnds/socklnd/socklnd_cb.c
lnet/lnet/lib-move.c
lnet/lnet/net_fault.c
lnet/selftest/conctl.c
lnet/selftest/module.c
lnet/selftest/rpc.c
lnet/utils/lnetconfig/liblnetconfig_netlink.c

index 3ee4e0c..11b4330 100644 (file)
@@ -109,6 +109,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 59fb6e7..6be0b2a 100644 (file)
@@ -874,7 +874,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;
@@ -1661,11 +1661,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);
@@ -2411,7 +2411,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;
@@ -3754,7 +3754,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 2797f50..815a13d 100644 (file)
@@ -2999,7 +2999,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;
@@ -3057,7 +3057,7 @@ kiblnd_shutdown(struct lnet_ni *ni)
                list_del(&net->ibn_list);
                write_unlock_irqrestore(g_lock, flags);
 
-               /* fall through */
+               fallthrough;
 
         case IBLND_INIT_NOTHING:
                LASSERT (atomic_read(&net->ibn_nconns) == 0);
index e96110d..6a95578 100644 (file)
@@ -2947,7 +2947,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 70add94..e3de347 100644 (file)
@@ -2116,7 +2116,7 @@ ksocknal_base_shutdown(void)
        switch (ksocknal_data.ksnd_init) {
        default:
                LASSERT(0);
-               /* fallthrough */
+               fallthrough;
 
        case SOCKNAL_INIT_ALL:
        case SOCKNAL_INIT_DATA:
index 3f9dcf7..4e7a61b 100644 (file)
@@ -1338,7 +1338,7 @@ ksocknal_process_receive(struct ksock_conn *conn,
                        ksocknal_close_conn_and_siblings(conn, rc);
                        return (-EPROTO);
                }
-               /* Fall through */
+               fallthrough;
 
        case SOCKNAL_RX_SLOP:
                /* starting new packet? */
index 7d117c7..289a482 100644 (file)
@@ -4013,7 +4013,7 @@ lnet_mt_event_handler(struct lnet_event *event)
        case LNET_EVENT_UNLINK:
                CDEBUG(D_NET, "%s recovery ping unlinked\n",
                       libcfs_nidstr(&ev_info->mt_nid));
-               /* fallthrough */
+               fallthrough;
        case LNET_EVENT_REPLY:
                lnet_handle_recovery_reply(ev_info, event->status, false,
                                           event->type == LNET_EVENT_UNLINK);
@@ -4216,7 +4216,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 ebdde6f..0a201a0 100644 (file)
@@ -714,7 +714,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 72199ee..9afbdae 100644 (file)
@@ -149,7 +149,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 16da5fd..1441600 100644 (file)
@@ -56,13 +56,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++) {
@@ -73,11 +73,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 6d00c1f..d0bdd01 100644 (file)
@@ -989,7 +989,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;
@@ -1031,7 +1031,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);
 
@@ -1231,7 +1231,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;
 
@@ -1265,7 +1265,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;
@@ -1439,14 +1439,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;
@@ -1569,7 +1569,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);
@@ -1581,7 +1581,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;
@@ -1655,7 +1655,7 @@ srpc_shutdown (void)
        switch (state) {
        default:
                LBUG();
-               /* fallthrough */
+               fallthrough;
        case SRPC_STATE_RUNNING:
                spin_lock(&srpc_data.rpc_glock);
 
@@ -1670,14 +1670,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();
index 98e6ac4..dd159dd 100644 (file)
 #include <linux/lnet/lnet-nl.h>
 #include "liblnetconfig.h"
 
+#ifndef fallthrough
+#define fallthrough do {} while (0)  /* fallthrough */
+#endif
+
 #ifndef SOL_NETLINK /* for glibc < 2.24 */
 # define SOL_NETLINK 270
 #endif
@@ -703,7 +707,7 @@ not_first:
                case NLA_S64:
                        len = snprintf(data->buffer, *size, "%jd",
                                       nla_get_s64(attr));
-               /* fallthrough */
+                       fallthrough;
                default:
                        break;
                }
@@ -1485,7 +1489,7 @@ void yaml_parser_log_error(yaml_parser_t *parser, FILE *log, const char *errmsg)
                        fprintf(log, "Reader error: '%s' at %ld\n",
                                extra, (long)parser->problem_offset);
                }
-       /* fallthrough */
+               fallthrough;
        default:
                break;
        }