Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] libceph: Convert to use the preferred fallthrough macro
@ 2020-08-18 12:26 Miaohe Lin
2020-08-18 19:56 ` Jeff Layton
0 siblings, 1 reply; 3+ messages in thread
From: Miaohe Lin @ 2020-08-18 12:26 UTC (permalink / raw)
To: idryomov, jlayton, davem, kuba, grandmaster
Cc: ceph-devel, netdev, linux-kernel, linmiaohe
Convert the uses of fallthrough comments to fallthrough macro.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
net/ceph/ceph_hash.c | 20 ++++++++++----------
net/ceph/crush/mapper.c | 2 +-
net/ceph/messenger.c | 4 ++--
net/ceph/mon_client.c | 2 +-
net/ceph/osd_client.c | 4 ++--
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/net/ceph/ceph_hash.c b/net/ceph/ceph_hash.c
index 81e1e006c540..16a47c0eef37 100644
--- a/net/ceph/ceph_hash.c
+++ b/net/ceph/ceph_hash.c
@@ -50,35 +50,35 @@ unsigned int ceph_str_hash_rjenkins(const char *str, unsigned int length)
switch (len) {
case 11:
c = c + ((__u32)k[10] << 24);
- /* fall through */
+ fallthrough;
case 10:
c = c + ((__u32)k[9] << 16);
- /* fall through */
+ fallthrough;
case 9:
c = c + ((__u32)k[8] << 8);
/* the first byte of c is reserved for the length */
- /* fall through */
+ fallthrough;
case 8:
b = b + ((__u32)k[7] << 24);
- /* fall through */
+ fallthrough;
case 7:
b = b + ((__u32)k[6] << 16);
- /* fall through */
+ fallthrough;
case 6:
b = b + ((__u32)k[5] << 8);
- /* fall through */
+ fallthrough;
case 5:
b = b + k[4];
- /* fall through */
+ fallthrough;
case 4:
a = a + ((__u32)k[3] << 24);
- /* fall through */
+ fallthrough;
case 3:
a = a + ((__u32)k[2] << 16);
- /* fall through */
+ fallthrough;
case 2:
a = a + ((__u32)k[1] << 8);
- /* fall through */
+ fallthrough;
case 1:
a = a + k[0];
/* case 0: nothing left to add */
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c
index 07e5614eb3f1..7057f8db4f99 100644
--- a/net/ceph/crush/mapper.c
+++ b/net/ceph/crush/mapper.c
@@ -987,7 +987,7 @@ int crush_do_rule(const struct crush_map *map,
case CRUSH_RULE_CHOOSELEAF_FIRSTN:
case CRUSH_RULE_CHOOSE_FIRSTN:
firstn = 1;
- /* fall through */
+ fallthrough;
case CRUSH_RULE_CHOOSELEAF_INDEP:
case CRUSH_RULE_CHOOSE_INDEP:
if (wsize == 0)
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 27d6ab11f9ee..bdfd66ba3843 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -412,7 +412,7 @@ static void ceph_sock_state_change(struct sock *sk)
switch (sk->sk_state) {
case TCP_CLOSE:
dout("%s TCP_CLOSE\n", __func__);
- /* fall through */
+ fallthrough;
case TCP_CLOSE_WAIT:
dout("%s TCP_CLOSE_WAIT\n", __func__);
con_sock_state_closing(con);
@@ -2751,7 +2751,7 @@ static int try_read(struct ceph_connection *con)
switch (ret) {
case -EBADMSG:
con->error_msg = "bad crc/signature";
- /* fall through */
+ fallthrough;
case -EBADE:
ret = -EIO;
break;
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 3d8c8015e976..d633a0aeaa55 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -1307,7 +1307,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
* request had a non-zero tid. Work around this weirdness
* by allocating a new message.
*/
- /* fall through */
+ fallthrough;
case CEPH_MSG_MON_MAP:
case CEPH_MSG_MDS_MAP:
case CEPH_MSG_OSD_MAP:
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index e4fbcad6e7d8..7901ab6c79fd 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -3854,7 +3854,7 @@ static void scan_requests(struct ceph_osd *osd,
if (!force_resend && !force_resend_writes)
break;
- /* fall through */
+ fallthrough;
case CALC_TARGET_NEED_RESEND:
cancel_linger_map_check(lreq);
/*
@@ -3891,7 +3891,7 @@ static void scan_requests(struct ceph_osd *osd,
!force_resend_writes))
break;
- /* fall through */
+ fallthrough;
case CALC_TARGET_NEED_RESEND:
cancel_map_check(req);
unlink_request(osd, req);
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] libceph: Convert to use the preferred fallthrough macro
2020-08-18 12:26 [PATCH] libceph: Convert to use the preferred fallthrough macro Miaohe Lin
@ 2020-08-18 19:56 ` Jeff Layton
2020-08-19 7:39 ` Ilya Dryomov
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2020-08-18 19:56 UTC (permalink / raw)
To: Miaohe Lin, idryomov, davem, kuba, grandmaster
Cc: ceph-devel, netdev, linux-kernel
On Tue, 2020-08-18 at 08:26 -0400, Miaohe Lin wrote:
> Convert the uses of fallthrough comments to fallthrough macro.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> net/ceph/ceph_hash.c | 20 ++++++++++----------
> net/ceph/crush/mapper.c | 2 +-
> net/ceph/messenger.c | 4 ++--
> net/ceph/mon_client.c | 2 +-
> net/ceph/osd_client.c | 4 ++--
> 5 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/net/ceph/ceph_hash.c b/net/ceph/ceph_hash.c
> index 81e1e006c540..16a47c0eef37 100644
> --- a/net/ceph/ceph_hash.c
> +++ b/net/ceph/ceph_hash.c
> @@ -50,35 +50,35 @@ unsigned int ceph_str_hash_rjenkins(const char *str, unsigned int length)
> switch (len) {
> case 11:
> c = c + ((__u32)k[10] << 24);
> - /* fall through */
> + fallthrough;
> case 10:
> c = c + ((__u32)k[9] << 16);
> - /* fall through */
> + fallthrough;
> case 9:
> c = c + ((__u32)k[8] << 8);
> /* the first byte of c is reserved for the length */
> - /* fall through */
> + fallthrough;
> case 8:
> b = b + ((__u32)k[7] << 24);
> - /* fall through */
> + fallthrough;
> case 7:
> b = b + ((__u32)k[6] << 16);
> - /* fall through */
> + fallthrough;
> case 6:
> b = b + ((__u32)k[5] << 8);
> - /* fall through */
> + fallthrough;
> case 5:
> b = b + k[4];
> - /* fall through */
> + fallthrough;
> case 4:
> a = a + ((__u32)k[3] << 24);
> - /* fall through */
> + fallthrough;
> case 3:
> a = a + ((__u32)k[2] << 16);
> - /* fall through */
> + fallthrough;
> case 2:
> a = a + ((__u32)k[1] << 8);
> - /* fall through */
> + fallthrough;
> case 1:
> a = a + k[0];
> /* case 0: nothing left to add */
> diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c
> index 07e5614eb3f1..7057f8db4f99 100644
> --- a/net/ceph/crush/mapper.c
> +++ b/net/ceph/crush/mapper.c
> @@ -987,7 +987,7 @@ int crush_do_rule(const struct crush_map *map,
> case CRUSH_RULE_CHOOSELEAF_FIRSTN:
> case CRUSH_RULE_CHOOSE_FIRSTN:
> firstn = 1;
> - /* fall through */
> + fallthrough;
> case CRUSH_RULE_CHOOSELEAF_INDEP:
> case CRUSH_RULE_CHOOSE_INDEP:
> if (wsize == 0)
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index 27d6ab11f9ee..bdfd66ba3843 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -412,7 +412,7 @@ static void ceph_sock_state_change(struct sock *sk)
> switch (sk->sk_state) {
> case TCP_CLOSE:
> dout("%s TCP_CLOSE\n", __func__);
> - /* fall through */
> + fallthrough;
> case TCP_CLOSE_WAIT:
> dout("%s TCP_CLOSE_WAIT\n", __func__);
> con_sock_state_closing(con);
> @@ -2751,7 +2751,7 @@ static int try_read(struct ceph_connection *con)
> switch (ret) {
> case -EBADMSG:
> con->error_msg = "bad crc/signature";
> - /* fall through */
> + fallthrough;
> case -EBADE:
> ret = -EIO;
> break;
> diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
> index 3d8c8015e976..d633a0aeaa55 100644
> --- a/net/ceph/mon_client.c
> +++ b/net/ceph/mon_client.c
> @@ -1307,7 +1307,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
> * request had a non-zero tid. Work around this weirdness
> * by allocating a new message.
> */
> - /* fall through */
> + fallthrough;
> case CEPH_MSG_MON_MAP:
> case CEPH_MSG_MDS_MAP:
> case CEPH_MSG_OSD_MAP:
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index e4fbcad6e7d8..7901ab6c79fd 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -3854,7 +3854,7 @@ static void scan_requests(struct ceph_osd *osd,
> if (!force_resend && !force_resend_writes)
> break;
>
> - /* fall through */
> + fallthrough;
> case CALC_TARGET_NEED_RESEND:
> cancel_linger_map_check(lreq);
> /*
> @@ -3891,7 +3891,7 @@ static void scan_requests(struct ceph_osd *osd,
> !force_resend_writes))
> break;
>
> - /* fall through */
> + fallthrough;
> case CALC_TARGET_NEED_RESEND:
> cancel_map_check(req);
> unlink_request(osd, req);
Looks sane. Merged into ceph-client/testing branch.
Thanks!
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] libceph: Convert to use the preferred fallthrough macro
2020-08-18 19:56 ` Jeff Layton
@ 2020-08-19 7:39 ` Ilya Dryomov
0 siblings, 0 replies; 3+ messages in thread
From: Ilya Dryomov @ 2020-08-19 7:39 UTC (permalink / raw)
To: Jeff Layton
Cc: Miaohe Lin, David S. Miller, kuba, Alexander A. Klimov,
Ceph Development, netdev, LKML
On Tue, Aug 18, 2020 at 9:56 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> On Tue, 2020-08-18 at 08:26 -0400, Miaohe Lin wrote:
> > Convert the uses of fallthrough comments to fallthrough macro.
> >
> > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> > ---
> > net/ceph/ceph_hash.c | 20 ++++++++++----------
> > net/ceph/crush/mapper.c | 2 +-
> > net/ceph/messenger.c | 4 ++--
> > net/ceph/mon_client.c | 2 +-
> > net/ceph/osd_client.c | 4 ++--
> > 5 files changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/net/ceph/ceph_hash.c b/net/ceph/ceph_hash.c
> > index 81e1e006c540..16a47c0eef37 100644
> > --- a/net/ceph/ceph_hash.c
> > +++ b/net/ceph/ceph_hash.c
> > @@ -50,35 +50,35 @@ unsigned int ceph_str_hash_rjenkins(const char *str, unsigned int length)
> > switch (len) {
> > case 11:
> > c = c + ((__u32)k[10] << 24);
> > - /* fall through */
> > + fallthrough;
> > case 10:
> > c = c + ((__u32)k[9] << 16);
> > - /* fall through */
> > + fallthrough;
> > case 9:
> > c = c + ((__u32)k[8] << 8);
> > /* the first byte of c is reserved for the length */
> > - /* fall through */
> > + fallthrough;
> > case 8:
> > b = b + ((__u32)k[7] << 24);
> > - /* fall through */
> > + fallthrough;
> > case 7:
> > b = b + ((__u32)k[6] << 16);
> > - /* fall through */
> > + fallthrough;
> > case 6:
> > b = b + ((__u32)k[5] << 8);
> > - /* fall through */
> > + fallthrough;
> > case 5:
> > b = b + k[4];
> > - /* fall through */
> > + fallthrough;
> > case 4:
> > a = a + ((__u32)k[3] << 24);
> > - /* fall through */
> > + fallthrough;
> > case 3:
> > a = a + ((__u32)k[2] << 16);
> > - /* fall through */
> > + fallthrough;
> > case 2:
> > a = a + ((__u32)k[1] << 8);
> > - /* fall through */
> > + fallthrough;
> > case 1:
> > a = a + k[0];
> > /* case 0: nothing left to add */
> > diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c
> > index 07e5614eb3f1..7057f8db4f99 100644
> > --- a/net/ceph/crush/mapper.c
> > +++ b/net/ceph/crush/mapper.c
> > @@ -987,7 +987,7 @@ int crush_do_rule(const struct crush_map *map,
> > case CRUSH_RULE_CHOOSELEAF_FIRSTN:
> > case CRUSH_RULE_CHOOSE_FIRSTN:
> > firstn = 1;
> > - /* fall through */
> > + fallthrough;
> > case CRUSH_RULE_CHOOSELEAF_INDEP:
> > case CRUSH_RULE_CHOOSE_INDEP:
> > if (wsize == 0)
> > diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> > index 27d6ab11f9ee..bdfd66ba3843 100644
> > --- a/net/ceph/messenger.c
> > +++ b/net/ceph/messenger.c
> > @@ -412,7 +412,7 @@ static void ceph_sock_state_change(struct sock *sk)
> > switch (sk->sk_state) {
> > case TCP_CLOSE:
> > dout("%s TCP_CLOSE\n", __func__);
> > - /* fall through */
> > + fallthrough;
> > case TCP_CLOSE_WAIT:
> > dout("%s TCP_CLOSE_WAIT\n", __func__);
> > con_sock_state_closing(con);
> > @@ -2751,7 +2751,7 @@ static int try_read(struct ceph_connection *con)
> > switch (ret) {
> > case -EBADMSG:
> > con->error_msg = "bad crc/signature";
> > - /* fall through */
> > + fallthrough;
> > case -EBADE:
> > ret = -EIO;
> > break;
> > diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
> > index 3d8c8015e976..d633a0aeaa55 100644
> > --- a/net/ceph/mon_client.c
> > +++ b/net/ceph/mon_client.c
> > @@ -1307,7 +1307,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
> > * request had a non-zero tid. Work around this weirdness
> > * by allocating a new message.
> > */
> > - /* fall through */
> > + fallthrough;
> > case CEPH_MSG_MON_MAP:
> > case CEPH_MSG_MDS_MAP:
> > case CEPH_MSG_OSD_MAP:
> > diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> > index e4fbcad6e7d8..7901ab6c79fd 100644
> > --- a/net/ceph/osd_client.c
> > +++ b/net/ceph/osd_client.c
> > @@ -3854,7 +3854,7 @@ static void scan_requests(struct ceph_osd *osd,
> > if (!force_resend && !force_resend_writes)
> > break;
> >
> > - /* fall through */
> > + fallthrough;
> > case CALC_TARGET_NEED_RESEND:
> > cancel_linger_map_check(lreq);
> > /*
> > @@ -3891,7 +3891,7 @@ static void scan_requests(struct ceph_osd *osd,
> > !force_resend_writes))
> > break;
> >
> > - /* fall through */
> > + fallthrough;
> > case CALC_TARGET_NEED_RESEND:
> > cancel_map_check(req);
> > unlink_request(osd, req);
>
>
> Looks sane. Merged into ceph-client/testing branch.
I amended this to also cover fs/ceph and rbd.
Thanks,
Ilya
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-19 7:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 12:26 [PATCH] libceph: Convert to use the preferred fallthrough macro Miaohe Lin
2020-08-18 19:56 ` Jeff Layton
2020-08-19 7:39 ` Ilya Dryomov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).