Use fallthrough macro

As of the Linux 5.9 kernel a fallthrough macro has been added which
should be used to anotate all intentional fallthrough paths.  Once
all of the kernel code paths have been updated to use fallthrough
the -Wimplicit-fallthrough option will because the default.  To
avoid warnings in the OpenZFS code base when this happens apply
the fallthrough macro.

Additional reading: https://lwn.net/Articles/794944/

Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #12441
This commit is contained in:
Brian Behlendorf
2021-09-14 09:17:54 -07:00
committed by Tony Hutter
parent 66c9e15686
commit 820c95750b
34 changed files with 84 additions and 39 deletions
+4 -4
View File
@@ -1064,10 +1064,10 @@ abd_raidz_gen_iterate(abd_t **cabds, abd_t *dabd,
switch (parity) {
case 3:
len = MIN(caiters[2].iter_mapsize, len);
/* falls through */
fallthrough;
case 2:
len = MIN(caiters[1].iter_mapsize, len);
/* falls through */
fallthrough;
case 1:
len = MIN(caiters[0].iter_mapsize, len);
}
@@ -1177,11 +1177,11 @@ abd_raidz_rec_iterate(abd_t **cabds, abd_t **tabds,
case 3:
len = MIN(xiters[2].iter_mapsize, len);
len = MIN(citers[2].iter_mapsize, len);
/* falls through */
fallthrough;
case 2:
len = MIN(xiters[1].iter_mapsize, len);
len = MIN(citers[1].iter_mapsize, len);
/* falls through */
fallthrough;
case 1:
len = MIN(xiters[0].iter_mapsize, len);
len = MIN(citers[0].iter_mapsize, len);
+1 -1
View File
@@ -749,7 +749,7 @@ dsl_prop_set_sync_impl(dsl_dataset_t *ds, const char *propname,
ASSERT(err == 0 || err == ENOENT);
err = zap_remove(mos, zapobj, inheritstr, tx);
ASSERT(err == 0 || err == ENOENT);
/* FALLTHRU */
fallthrough;
case (ZPROP_SRC_NONE | ZPROP_SRC_RECEIVED):
/*
* remove propname$recvd
+1 -1
View File
@@ -9533,7 +9533,7 @@ spa_activity_in_progress(spa_t *spa, zpool_wait_activity_t activity,
case ZPOOL_WAIT_RESILVER:
if ((*in_progress = vdev_rebuild_active(spa->spa_root_vdev)))
break;
/* fall through */
fallthrough;
case ZPOOL_WAIT_SCRUB:
{
boolean_t scanning, paused, is_scrub;
+1 -1
View File
@@ -1288,7 +1288,7 @@ vdev_label_read_bootenv(vdev_t *rvd, nvlist_t *bootenv)
nvlist_free(config);
break;
}
/* FALLTHROUGH */
fallthrough;
default:
/* Check for FreeBSD zfs bootonce command string */
buf = abd_to_buf(abd);
+1 -1
View File
@@ -142,7 +142,7 @@ static const struct {
a.b[6] = mul_lt[a.b[6]]; \
a.b[5] = mul_lt[a.b[5]]; \
a.b[4] = mul_lt[a.b[4]]; \
/* falls through */ \
fallthrough; \
case 4: \
a.b[3] = mul_lt[a.b[3]]; \
a.b[2] = mul_lt[a.b[2]]; \
+4 -6
View File
@@ -362,7 +362,7 @@ zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
(void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
lr->lr_uid, lr->lr_gid);
/*FALLTHROUGH*/
fallthrough;
case TX_CREATE_ACL_ATTR:
if (name == NULL) {
lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
@@ -394,7 +394,7 @@ zfs_replay_create_acl(void *arg1, void *arg2, boolean_t byteswap)
zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
(void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
lr->lr_uid, lr->lr_gid);
/*FALLTHROUGH*/
fallthrough;
case TX_MKDIR_ACL_ATTR:
if (name == NULL) {
lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
@@ -519,8 +519,7 @@ zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
zfs_replay_fuid_domain(start, &start,
lr->lr_uid, lr->lr_gid);
name = (char *)start;
/*FALLTHROUGH*/
fallthrough;
case TX_CREATE:
if (name == NULL)
name = (char *)start;
@@ -537,8 +536,7 @@ zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
zfs_replay_fuid_domain(start, &start,
lr->lr_uid, lr->lr_gid);
name = (char *)start;
/*FALLTHROUGH*/
fallthrough;
case TX_MKDIR:
if (name == NULL)
name = (char *)(lr + 1);
+1 -1
View File
@@ -214,7 +214,7 @@ zio_compress_to_feature(enum zio_compress comp)
case ZIO_COMPRESS_ZSTD:
return (SPA_FEATURE_ZSTD_COMPRESS);
default:
/* fallthru */;
break;
}
return (SPA_FEATURE_NONE);
}