File 0026-LU-15220-lnet-use-fallthrough-pseudo-keyword-for-swi.patch of Package lustre_2_12
From 55cd5e8403fdabd6573332ea58c15c6ec9328c95 Mon Sep 17 00:00:00 2001
From: Jian Yu <yujian@whamcloud.com>
Date: Thu, 20 Jan 2022 10:19:34 -0800
Subject: [PATCH 26/35] LU-15220 lnet: 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: 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>
---
lnet/include/lnet/lib-lnet.h | 4 ++
lnet/klnds/gnilnd/gnilnd_cb.c | 11 ++---
lnet/klnds/o2iblnd/o2iblnd.c | 7 ++--
lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +-
lnet/klnds/socklnd/socklnd.c | 2 +-
lnet/klnds/socklnd/socklnd_cb.c | 2 +-
lnet/lnet/lib-move.c | 4 +-
lnet/lnet/net_fault.c | 1 +
lnet/selftest/conctl.c | 2 +-
lnet/selftest/module.c | 10 ++---
lnet/selftest/rpc.c | 71 +++++++++++++++++++--------------
11 files changed, 65 insertions(+), 51 deletions(-)
diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h
index b14a057e8a3c..c225d7d7ff4c 100644
--- a/lnet/include/lnet/lib-lnet.h
+++ b/lnet/include/lnet/lib-lnet.h
@@ -98,6 +98,10 @@ static inline int lnet_is_route_alive(struct lnet_route *route)
return route->lr_downis == 0;
}
+#ifndef fallthrough
+#define fallthrough do {} while (0) /* fallthrough */
+#endif
+
static inline int lnet_is_wire_handle_none(struct lnet_handle_wire *wh)
{
return (wh->wh_interface_cookie == LNET_WIRE_HANDLE_COOKIE_NONE &&
diff --git a/lnet/klnds/gnilnd/gnilnd_cb.c b/lnet/klnds/gnilnd/gnilnd_cb.c
index 89f8bd224e71..87aa6f88b34f 100644
--- a/lnet/klnds/gnilnd/gnilnd_cb.c
+++ b/lnet/klnds/gnilnd/gnilnd_cb.c
@@ -920,7 +920,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);
}
- /* fall through to dump log */
+ fallthrough;
case 1:
libcfs_debug_dumplog();
break;
@@ -1745,11 +1745,12 @@ kgnilnd_queue_tx(kgn_conn_t *conn, kgn_tx_t *tx)
/* it was sent, break out of switch to avoid default case of queueing */
break;
}
- /* needs to queue to try again, so fall through to default case */
+ /* needs to queue to try again, so... */
+ 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);
@@ -2503,7 +2504,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);
- /* fall through to dump */
+ fallthrough;
case 1:
libcfs_debug_dumplog();
break;
@@ -3851,7 +3852,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;
case GNILND_MSG_PUT_ACK:
case GNILND_MSG_PUT_REQ_REV:
case GNILND_MSG_GET_ACK_REV:
diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c
index 8a14b86f904c..7da3be892046 100644
--- a/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2952,10 +2952,9 @@ kiblnd_base_shutdown(void)
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(cfs_time_seconds(1));
}
+ fallthrough;
- /* fall through */
-
- case IBLND_INIT_NOTHING:
+ case IBLND_INIT_NOTHING:
break;
}
@@ -3024,7 +3023,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);
diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c
index ca408378ab77..88f6c3b6f165 100644
--- a/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -2993,7 +2993,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);
diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c
index 9b199e3ab541..32dda0a5769b 100644
--- a/lnet/klnds/socklnd/socklnd.c
+++ b/lnet/klnds/socklnd/socklnd.c
@@ -2273,7 +2273,7 @@ ksocknal_base_shutdown(void)
switch (ksocknal_data.ksnd_init) {
default:
LASSERT(0);
- /* fallthrough */
+ fallthrough;
case SOCKNAL_INIT_ALL:
case SOCKNAL_INIT_DATA:
diff --git a/lnet/klnds/socklnd/socklnd_cb.c b/lnet/klnds/socklnd/socklnd_cb.c
index 1da3fe51398c..69e275e18add 100644
--- a/lnet/klnds/socklnd/socklnd_cb.c
+++ b/lnet/klnds/socklnd/socklnd_cb.c
@@ -1366,7 +1366,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? */
diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c
index b66715c50bdd..0226c30917b8 100644
--- a/lnet/lnet/lib-move.c
+++ b/lnet/lnet/lib-move.c
@@ -3612,7 +3612,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,
event->type == LNET_EVENT_UNLINK);
@@ -3827,7 +3827,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"
diff --git a/lnet/lnet/net_fault.c b/lnet/lnet/net_fault.c
index 6b1469e58248..4013ac47ab09 100644
--- a/lnet/lnet/net_fault.c
+++ b/lnet/lnet/net_fault.c
@@ -704,6 +704,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;
case LNET_CREDIT_WAIT:
continue;
default: /* failures */
diff --git a/lnet/selftest/conctl.c b/lnet/selftest/conctl.c
index 7ce53bbabff3..189435b4375f 100644
--- a/lnet/selftest/conctl.c
+++ b/lnet/selftest/conctl.c
@@ -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;
diff --git a/lnet/selftest/module.c b/lnet/selftest/module.c
index 532495750094..e0baadb6b920 100644
--- a/lnet/selftest/module.c
+++ b/lnet/selftest/module.c
@@ -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++) {
@@ -75,11 +75,11 @@ lnet_selftest_exit(void)
sizeof(lst_sched_test[0]) *
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:
diff --git a/lnet/selftest/rpc.c b/lnet/selftest/rpc.c
index 17e7e60a5fa2..0fbb01cade01 100644
--- a/lnet/selftest/rpc.c
+++ b/lnet/selftest/rpc.c
@@ -980,9 +980,10 @@ static int srpc_handle_rpc(struct swi_workitem *wi)
spin_unlock(&scd->scd_lock);
switch (wi->swi_state) {
- default:
- LBUG ();
- case SWI_STATE_NEWBORN: {
+ default:
+ LBUG();
+ fallthrough;
+ case SWI_STATE_NEWBORN: {
struct srpc_msg *msg;
struct srpc_generic_reply *reply;
@@ -1021,10 +1022,11 @@ static int srpc_handle_rpc(struct swi_workitem *wi)
LASSERT (ev->ev_fired);
ev->ev_status = rc;
- }
- }
- case SWI_STATE_BULK_STARTED:
- LASSERT (rpc->srpc_bulk == NULL || ev->ev_fired);
+ }
+ }
+ fallthrough;
+ case SWI_STATE_BULK_STARTED:
+ LASSERT(rpc->srpc_bulk == NULL || ev->ev_fired);
if (rpc->srpc_bulk != NULL) {
rc = ev->ev_status;
@@ -1219,7 +1221,7 @@ srpc_send_rpc(struct swi_workitem *wi)
if (rc != 0) break;
wi->swi_state = SWI_STATE_REQUEST_SENT;
- /* perhaps more events, fall thru */
+ fallthrough;
case SWI_STATE_REQUEST_SENT: {
enum srpc_msg_type type;
@@ -1251,10 +1253,12 @@ srpc_send_rpc(struct swi_workitem *wi)
LNetMDUnlink(rpc->crpc_bulk.bk_mdh);
}
- wi->swi_state = SWI_STATE_REPLY_RECEIVED;
- }
- case SWI_STATE_REPLY_RECEIVED:
- if (do_bulk && !rpc->crpc_bulkev.ev_fired) break;
+ wi->swi_state = SWI_STATE_REPLY_RECEIVED;
+ }
+ fallthrough;
+ case SWI_STATE_REPLY_RECEIVED:
+ if (do_bulk && !rpc->crpc_bulkev.ev_fired)
+ break;
rc = do_bulk ? rpc->crpc_bulkev.ev_status : 0;
@@ -1423,16 +1427,18 @@ srpc_lnet_ev_handler(struct lnet_event *ev)
switch (rpcev->ev_type) {
default:
CERROR("Unknown event: status %d, type %d, lnet %d\n",
- rpcev->ev_status, rpcev->ev_type, rpcev->ev_lnet);
- LBUG ();
- case SRPC_REQUEST_SENT:
- if (ev->status == 0 && ev->type != LNET_EVENT_UNLINK) {
+ rpcev->ev_status, rpcev->ev_type, rpcev->ev_lnet);
+ LBUG();
+ 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);
- }
- case SRPC_REPLY_RCVD:
- case SRPC_BULK_REQ_RCVD:
+ }
+ fallthrough;
+ case SRPC_REPLY_RCVD:
+ case SRPC_BULK_REQ_RCVD:
crpc = rpcev->ev_data;
if (rpcev != &crpc->crpc_reqstev &&
@@ -1549,11 +1555,11 @@ srpc_lnet_ev_handler(struct lnet_event *ev)
ev->type == LNET_EVENT_REPLY ||
ev->type == LNET_EVENT_UNLINK);
- if (!ev->unlinked)
- break; /* wait for final event */
-
- case SRPC_BULK_PUT_SENT:
- if (ev->status == 0 && ev->type != LNET_EVENT_UNLINK) {
+ if (!ev->unlinked)
+ break; /* wait for final event */
+ fallthrough;
+ case SRPC_BULK_PUT_SENT:
+ if (ev->status == 0 && ev->type != LNET_EVENT_UNLINK) {
spin_lock(&srpc_data.rpc_glock);
if (rpcev->ev_type == SRPC_BULK_GET_RPLD)
@@ -1563,6 +1569,7 @@ srpc_lnet_ev_handler(struct lnet_event *ev)
spin_unlock(&srpc_data.rpc_glock);
}
+ fallthrough;
case SRPC_REPLY_SENT:
srpc = rpcev->ev_data;
scd = srpc->srpc_scd;
@@ -1641,9 +1648,10 @@ srpc_shutdown (void)
srpc_data.rpc_state = SRPC_STATE_STOPPING;
switch (state) {
- default:
- LBUG ();
- case SRPC_STATE_RUNNING:
+ default:
+ LBUG();
+ fallthrough;
+ case SRPC_STATE_RUNNING:
spin_lock(&srpc_data.rpc_glock);
for (i = 0; i <= SRPC_SERVICE_MAX_ID; i++) {
@@ -1656,15 +1664,16 @@ srpc_shutdown (void)
spin_unlock(&srpc_data.rpc_glock);
- stt_shutdown();
+ stt_shutdown();
+ fallthrough;
- case SRPC_STATE_EQ_INIT:
+ case SRPC_STATE_EQ_INIT:
rc = LNetClearLazyPortal(SRPC_FRAMEWORK_REQUEST_PORTAL);
rc = LNetClearLazyPortal(SRPC_REQUEST_PORTAL);
LASSERT (rc == 0);
rc = LNetEQFree(srpc_data.rpc_lnet_eq);
- LASSERT (rc == 0); /* the EQ should have no user by now */
-
+ LASSERT (rc == 0);
+ fallthrough;
case SRPC_STATE_NI_INIT:
LNetNIFini();
}
--
2.41.0