提交 1ef907ec 编写于 作者: G Gustavo A. R. Silva 提交者: Zheng Zengkai

xfs: Fix fall-through warnings for Clang

mainline-inclusion
from mainline-v5.13-rc2
commit 53004ee7
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4KIAO
CVE: NA

Reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=53004ee78d6273c994534ccf79d993098ac89769

-------------------------------------------------

In preparation to enable -Wimplicit-fallthrough for Clang, fix
the following warnings by replacing /* fall through */ comments,
and its variants, with the new pseudo-keyword macro fallthrough:

fs/xfs/libxfs/xfs_alloc.c:3167:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/libxfs/xfs_da_btree.c:286:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/libxfs/xfs_ag_resv.c:346:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/libxfs/xfs_ag_resv.c:388:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_bmap_util.c:246:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_export.c:88:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_export.c:96:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_file.c:867:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_ioctl.c:562:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_ioctl.c:1548:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_iomap.c:1040:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_inode.c:852:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_log.c:2627:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/xfs_trans_buf.c:298:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/scrub/bmap.c:275:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/scrub/btree.c:48:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/scrub/common.c:85:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/scrub/common.c:138:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/scrub/common.c:698:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/scrub/dabtree.c:51:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/scrub/repair.c:951:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
fs/xfs/scrub/agheader.c:89:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]

Notice that Clang doesn't recognize /* fall through */ comments as
implicit fall-through markings, so in order to globally enable
-Wimplicit-fallthrough for Clang, these comments need to be
replaced with fallthrough; in the whole codebase.

Link: https://github.com/KSPP/linux/issues/115Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: NGuo Xuenan <guoxuenan@huawei.com>
Reviewed-by: NLihong Kou <koulihong@huawei.com>
Reviewed-by: NZhang Yi <yi.zhang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b28bb602
...@@ -362,7 +362,7 @@ xfs_ag_resv_alloc_extent( ...@@ -362,7 +362,7 @@ xfs_ag_resv_alloc_extent(
break; break;
default: default:
ASSERT(0); ASSERT(0);
/* fall through */ fallthrough;
case XFS_AG_RESV_NONE: case XFS_AG_RESV_NONE:
field = args->wasdel ? XFS_TRANS_SB_RES_FDBLOCKS : field = args->wasdel ? XFS_TRANS_SB_RES_FDBLOCKS :
XFS_TRANS_SB_FDBLOCKS; XFS_TRANS_SB_FDBLOCKS;
...@@ -404,7 +404,7 @@ xfs_ag_resv_free_extent( ...@@ -404,7 +404,7 @@ xfs_ag_resv_free_extent(
break; break;
default: default:
ASSERT(0); ASSERT(0);
/* fall through */ fallthrough;
case XFS_AG_RESV_NONE: case XFS_AG_RESV_NONE:
xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (int64_t)len); xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (int64_t)len);
return; return;
......
...@@ -3110,7 +3110,7 @@ xfs_alloc_vextent( ...@@ -3110,7 +3110,7 @@ xfs_alloc_vextent(
} }
args->agbno = XFS_FSB_TO_AGBNO(mp, args->fsbno); args->agbno = XFS_FSB_TO_AGBNO(mp, args->fsbno);
args->type = XFS_ALLOCTYPE_NEAR_BNO; args->type = XFS_ALLOCTYPE_NEAR_BNO;
/* FALLTHROUGH */ fallthrough;
case XFS_ALLOCTYPE_FIRST_AG: case XFS_ALLOCTYPE_FIRST_AG:
/* /*
* Rotate through the allocation groups looking for a winner. * Rotate through the allocation groups looking for a winner.
......
...@@ -282,7 +282,7 @@ xfs_da3_node_read_verify( ...@@ -282,7 +282,7 @@ xfs_da3_node_read_verify(
__this_address); __this_address);
break; break;
} }
/* fall through */ fallthrough;
case XFS_DA_NODE_MAGIC: case XFS_DA_NODE_MAGIC:
fa = xfs_da3_node_verify(bp); fa = xfs_da3_node_verify(bp);
if (fa) if (fa)
......
...@@ -86,6 +86,7 @@ xchk_superblock( ...@@ -86,6 +86,7 @@ xchk_superblock(
case -ENOSYS: case -ENOSYS:
case -EFBIG: case -EFBIG:
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
fallthrough;
default: default:
break; break;
} }
......
...@@ -272,7 +272,7 @@ xchk_bmap_iextent_xref( ...@@ -272,7 +272,7 @@ xchk_bmap_iextent_xref(
case XFS_DATA_FORK: case XFS_DATA_FORK:
if (xfs_is_reflink_inode(info->sc->ip)) if (xfs_is_reflink_inode(info->sc->ip))
break; break;
/* fall through */ fallthrough;
case XFS_ATTR_FORK: case XFS_ATTR_FORK:
xchk_xref_is_not_shared(info->sc, agbno, xchk_xref_is_not_shared(info->sc, agbno,
irec->br_blockcount); irec->br_blockcount);
......
...@@ -43,7 +43,7 @@ __xchk_btree_process_error( ...@@ -43,7 +43,7 @@ __xchk_btree_process_error(
/* Note the badness but don't abort. */ /* Note the badness but don't abort. */
sc->sm->sm_flags |= errflag; sc->sm->sm_flags |= errflag;
*error = 0; *error = 0;
/* fall through */ fallthrough;
default: default:
if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE)
trace_xchk_ifork_btree_op_error(sc, cur, level, trace_xchk_ifork_btree_op_error(sc, cur, level,
......
...@@ -83,7 +83,7 @@ __xchk_process_error( ...@@ -83,7 +83,7 @@ __xchk_process_error(
/* Note the badness but don't abort. */ /* Note the badness but don't abort. */
sc->sm->sm_flags |= errflag; sc->sm->sm_flags |= errflag;
*error = 0; *error = 0;
/* fall through */ fallthrough;
default: default:
trace_xchk_op_error(sc, agno, bno, *error, trace_xchk_op_error(sc, agno, bno, *error,
ret_ip); ret_ip);
...@@ -136,7 +136,7 @@ __xchk_fblock_process_error( ...@@ -136,7 +136,7 @@ __xchk_fblock_process_error(
/* Note the badness but don't abort. */ /* Note the badness but don't abort. */
sc->sm->sm_flags |= errflag; sc->sm->sm_flags |= errflag;
*error = 0; *error = 0;
/* fall through */ fallthrough;
default: default:
trace_xchk_file_op_error(sc, whichfork, offset, *error, trace_xchk_file_op_error(sc, whichfork, offset, *error,
ret_ip); ret_ip);
...@@ -715,7 +715,7 @@ xchk_get_inode( ...@@ -715,7 +715,7 @@ xchk_get_inode(
if (error) if (error)
return -ENOENT; return -ENOENT;
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
/* fall through */ fallthrough;
default: default:
trace_xchk_op_error(sc, trace_xchk_op_error(sc,
XFS_INO_TO_AGNO(mp, sc->sm->sm_ino), XFS_INO_TO_AGNO(mp, sc->sm->sm_ino),
......
...@@ -47,7 +47,7 @@ xchk_da_process_error( ...@@ -47,7 +47,7 @@ xchk_da_process_error(
/* Note the badness but don't abort. */ /* Note the badness but don't abort. */
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
*error = 0; *error = 0;
/* fall through */ fallthrough;
default: default:
trace_xchk_file_op_error(sc, ds->dargs.whichfork, trace_xchk_file_op_error(sc, ds->dargs.whichfork,
xfs_dir2_da_to_db(ds->dargs.geo, xfs_dir2_da_to_db(ds->dargs.geo,
......
...@@ -944,7 +944,7 @@ xrep_ino_dqattach( ...@@ -944,7 +944,7 @@ xrep_ino_dqattach(
xrep_force_quotacheck(sc, XFS_DQTYPE_GROUP); xrep_force_quotacheck(sc, XFS_DQTYPE_GROUP);
if (XFS_IS_PQUOTA_ON(sc->mp) && !sc->ip->i_pdquot) if (XFS_IS_PQUOTA_ON(sc->mp) && !sc->ip->i_pdquot)
xrep_force_quotacheck(sc, XFS_DQTYPE_PROJ); xrep_force_quotacheck(sc, XFS_DQTYPE_PROJ);
/* fall through */ fallthrough;
case -ESRCH: case -ESRCH:
error = 0; error = 0;
break; break;
......
...@@ -244,7 +244,7 @@ xfs_bmap_count_blocks( ...@@ -244,7 +244,7 @@ xfs_bmap_count_blocks(
*/ */
*count += btblocks - 1; *count += btblocks - 1;
/* fall through */ fallthrough;
case XFS_DINODE_FMT_EXTENTS: case XFS_DINODE_FMT_EXTENTS:
*nextents = xfs_bmap_count_leaves(ifp, count); *nextents = xfs_bmap_count_leaves(ifp, count);
break; break;
......
...@@ -84,7 +84,7 @@ xfs_fs_encode_fh( ...@@ -84,7 +84,7 @@ xfs_fs_encode_fh(
case FILEID_INO32_GEN_PARENT: case FILEID_INO32_GEN_PARENT:
fid->i32.parent_ino = XFS_I(parent)->i_ino; fid->i32.parent_ino = XFS_I(parent)->i_ino;
fid->i32.parent_gen = parent->i_generation; fid->i32.parent_gen = parent->i_generation;
/*FALLTHRU*/ fallthrough;
case FILEID_INO32_GEN: case FILEID_INO32_GEN:
fid->i32.ino = XFS_I(inode)->i_ino; fid->i32.ino = XFS_I(inode)->i_ino;
fid->i32.gen = inode->i_generation; fid->i32.gen = inode->i_generation;
...@@ -92,7 +92,7 @@ xfs_fs_encode_fh( ...@@ -92,7 +92,7 @@ xfs_fs_encode_fh(
case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG: case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG:
fid64->parent_ino = XFS_I(parent)->i_ino; fid64->parent_ino = XFS_I(parent)->i_ino;
fid64->parent_gen = parent->i_generation; fid64->parent_gen = parent->i_generation;
/*FALLTHRU*/ fallthrough;
case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG: case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG:
fid64->ino = XFS_I(inode)->i_ino; fid64->ino = XFS_I(inode)->i_ino;
fid64->gen = inode->i_generation; fid64->gen = inode->i_generation;
......
...@@ -805,7 +805,7 @@ xfs_break_layouts( ...@@ -805,7 +805,7 @@ xfs_break_layouts(
error = xfs_break_dax_layouts(inode, &retry); error = xfs_break_dax_layouts(inode, &retry);
if (error || retry) if (error || retry)
break; break;
/* fall through */ fallthrough;
case BREAK_WRITE: case BREAK_WRITE:
error = xfs_break_leased_layouts(inode, iolock, &retry); error = xfs_break_leased_layouts(inode, iolock, &retry);
break; break;
......
...@@ -907,7 +907,7 @@ xfs_ialloc( ...@@ -907,7 +907,7 @@ xfs_ialloc(
xfs_inode_inherit_flags(ip, pip); xfs_inode_inherit_flags(ip, pip);
if (pip && (pip->i_d.di_flags2 & XFS_DIFLAG2_ANY)) if (pip && (pip->i_d.di_flags2 & XFS_DIFLAG2_ANY))
xfs_inode_inherit_flags2(ip, pip); xfs_inode_inherit_flags2(ip, pip);
/* FALLTHROUGH */ fallthrough;
case S_IFLNK: case S_IFLNK:
ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS; ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS;
ip->i_df.if_flags = XFS_IFEXTENTS; ip->i_df.if_flags = XFS_IFEXTENTS;
......
...@@ -557,7 +557,7 @@ xfs_ioc_attrmulti_one( ...@@ -557,7 +557,7 @@ xfs_ioc_attrmulti_one(
case ATTR_OP_REMOVE: case ATTR_OP_REMOVE:
value = NULL; value = NULL;
*len = 0; *len = 0;
/* fall through */ fallthrough;
case ATTR_OP_SET: case ATTR_OP_SET:
error = mnt_want_write_file(parfilp); error = mnt_want_write_file(parfilp);
if (error) if (error)
...@@ -1669,7 +1669,7 @@ xfs_ioc_getbmap( ...@@ -1669,7 +1669,7 @@ xfs_ioc_getbmap(
switch (cmd) { switch (cmd) {
case XFS_IOC_GETBMAPA: case XFS_IOC_GETBMAPA:
bmx.bmv_iflags = BMV_IF_ATTRFORK; bmx.bmv_iflags = BMV_IF_ATTRFORK;
/*FALLTHRU*/ fallthrough;
case XFS_IOC_GETBMAP: case XFS_IOC_GETBMAP:
if (file->f_mode & FMODE_NOCMTIME) if (file->f_mode & FMODE_NOCMTIME)
bmx.bmv_iflags |= BMV_IF_NO_DMAPI_READ; bmx.bmv_iflags |= BMV_IF_NO_DMAPI_READ;
......
...@@ -1031,7 +1031,7 @@ xfs_buffered_write_iomap_begin( ...@@ -1031,7 +1031,7 @@ xfs_buffered_write_iomap_begin(
prealloc_blocks = 0; prealloc_blocks = 0;
goto retry; goto retry;
} }
/*FALLTHRU*/ fallthrough;
default: default:
goto out_unlock; goto out_unlock;
} }
......
...@@ -2547,6 +2547,7 @@ xlog_covered_state( ...@@ -2547,6 +2547,7 @@ xlog_covered_state(
case XLOG_STATE_COVER_IDLE: case XLOG_STATE_COVER_IDLE:
if (iclogs_changed == 1) if (iclogs_changed == 1)
return XLOG_STATE_COVER_IDLE; return XLOG_STATE_COVER_IDLE;
fallthrough;
case XLOG_STATE_COVER_NEED: case XLOG_STATE_COVER_NEED:
case XLOG_STATE_COVER_NEED2: case XLOG_STATE_COVER_NEED2:
break; break;
......
...@@ -294,7 +294,7 @@ xfs_trans_read_buf_map( ...@@ -294,7 +294,7 @@ xfs_trans_read_buf_map(
default: default:
if (tp && (tp->t_flags & XFS_TRANS_DIRTY)) if (tp && (tp->t_flags & XFS_TRANS_DIRTY))
xfs_force_shutdown(tp->t_mountp, SHUTDOWN_META_IO_ERROR); xfs_force_shutdown(tp->t_mountp, SHUTDOWN_META_IO_ERROR);
/* fall through */ fallthrough;
case -ENOMEM: case -ENOMEM:
case -EAGAIN: case -EAGAIN:
return error; return error;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册