xfs: Use fallthrough pseudo-keyword
PATCH 1/1 xfs: Use fallthrough pseudo-keyword
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case.
--- fs/xfs/libxfs/xfs_ag_resv.c | 4 ++-- fs/xfs/libxfs/xfs_alloc.c | 2 +- fs/xfs/libxfs/xfs_da_btree.c | 2 +- fs/xfs/libxfs/xfs_inode_buf.c | 4 ++-- fs/xfs/scrub/bmap.c | 2 +- fs/xfs/scrub/btree.c | 2 +- fs/xfs/scrub/common.c | 6 +++--- fs/xfs/scrub/dabtree.c | 2 +- fs/xfs/scrub/repair.c | 2 +- fs/xfs/xfs_bmap_util.c | 2 +- fs/xfs/xfs_export.c | 4 ++-- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_fsmap.c | 2 +- fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_ioctl.c | 4 ++-- fs/xfs/xfs_iomap.c | 2 +- fs/xfs/xfs_trans_buf.c | 2 +- 17 files changed, 23 insertions(+), 23 deletions(-)
fs/xfs/libxfs/xfs_ag_resv.c +2 -2
@@ -338,7 +338,7 @@ xfs_ag_resv_alloc_extent(break ;default :ASSERT (0 ); -/* fall through */ + fallthrough;case XFS_AG_RESV_NONE : field = args->wasdel ?XFS_TRANS_SB_RES_FDBLOCKS :XFS_TRANS_SB_FDBLOCKS ;
@@ -380,7 +380,7 @@ xfs_ag_resv_free_extent(break ;default :ASSERT (0 ); -/* fall through */ + fallthrough;case XFS_AG_RESV_NONE :xfs_trans_mod_sb (tp,XFS_TRANS_SB_FDBLOCKS , (int64_t )len);return ;
fs/xfs/libxfs/xfs_alloc.c +1 -1
@@ -3119,7 +3119,7 @@ xfs_alloc_vextent( } args->agbno =XFS_FSB_TO_AGBNO (mp, args->fsbno); args->type =XFS_ALLOCTYPE_NEAR_BNO ; -/* FALLTHROUGH */ + fallthrough;case XFS_ALLOCTYPE_FIRST_AG :/* * Rotate through the allocation groups looking for a winner.
fs/xfs/libxfs/xfs_da_btree.c +1 -1
@@ -276,7 +276,7 @@ xfs_da3_node_read_verify( __this_address);break ; } -/* fall through */ + fallthrough;case XFS_DA_NODE_MAGIC : fa =xfs_da3_node_verify (bp);if (fa)
fs/xfs/libxfs/xfs_inode_buf.c +2 -2
@@ -439,8 +439,8 @@ xfs_dinode_verify_forkoff(if (dip->di_forkoff != (roundup (sizeof (xfs_dev_t),8 ) >>3 ))return __this_address;break ; -case XFS_DINODE_FMT_LOCAL :/* fall through ... */ -case XFS_DINODE_FMT_EXTENTS :/* fall through ... */ +case XFS_DINODE_FMT_LOCAL : +case XFS_DINODE_FMT_EXTENTS :case XFS_DINODE_FMT_BTREE :if (dip->di_forkoff >= (XFS_LITINO (mp) >>3 ))return __this_address;
fs/xfs/scrub/bmap.c +1 -1
@@ -252,7 +252,7 @@ xchk_bmap_iextent_xref(case XFS_DATA_FORK :if (xfs_is_reflink_inode (info->sc->ip))break ; -/* fall through */ + fallthrough;case XFS_ATTR_FORK :xchk_xref_is_not_shared (info->sc, agbno, irec->br_blockcount);
fs/xfs/scrub/btree.c +1 -1
@@ -43,7 +43,7 @@ __xchk_btree_process_error(/* Note the badness but don't abort. */ sc->sm->sm_flags |= errflag; *error =0 ; -/* fall through */ + fallthrough;default :if (cur->bc_flags &XFS_BTREE_ROOT_IN_INODE ) trace_xchk_ifork_btree_op_error(sc, cur, level,
fs/xfs/scrub/common.c +3 -3
@@ -81,7 +81,7 @@ __xchk_process_error(/* Note the badness but don't abort. */ sc->sm->sm_flags |= errflag; *error =0 ; -/* fall through */ + fallthrough;default :trace_xchk_op_error (sc, agno, bno, *error, ret_ip);
@@ -134,7 +134,7 @@ __xchk_fblock_process_error(/* Note the badness but don't abort. */ sc->sm->sm_flags |= errflag; *error =0 ; -/* fall through */ + fallthrough;default :trace_xchk_file_op_error (sc, whichfork, offset, *error, ret_ip);
@@ -713,7 +713,7 @@ xchk_get_inode(if (error)return -ENOENT ; error = -EFSCORRUPTED ; -/* fall through */ + fallthrough;default : trace_xchk_op_error(sc, XFS_INO_TO_AGNO(mp, sc->sm->sm_ino),
fs/xfs/scrub/dabtree.c +1 -1
@@ -47,7 +47,7 @@ xchk_da_process_error(/* Note the badness but don't abort. */ sc->sm->sm_flags |=XFS_SCRUB_OFLAG_CORRUPT ; *error =0 ; -/* fall through */ + fallthrough;default : trace_xchk_file_op_error(sc, ds->dargs.whichfork, xfs_dir2_da_to_db(ds->dargs.geo,
fs/xfs/scrub/repair.c +1 -1
@@ -944,7 +944,7 @@ xrep_ino_dqattach(xrep_force_quotacheck (sc,XFS_DQ_GROUP );if (XFS_IS_PQUOTA_ON (sc->mp) && !sc->ip->i_pdquot)xrep_force_quotacheck (sc,XFS_DQ_PROJ ); -/* fall through */ + fallthrough;case -ESRCH : error =0 ;break ;
fs/xfs/xfs_bmap_util.c +1 -1
@@ -244,7 +244,7 @@ xfs_bmap_count_blocks(*/ *count += btblocks -1 ; -/* fall through */ + fallthrough;case XFS_DINODE_FMT_EXTENTS : *nextents =xfs_bmap_count_leaves (ifp, count);break ;
fs/xfs/xfs_export.c +2 -2
@@ -84,7 +84,7 @@ xfs_fs_encode_fh(case FILEID_INO32_GEN_PARENT : fid->i32.parent_ino =XFS_I (parent)->i_ino; fid->i32.parent_gen = parent->i_generation; -/*FALLTHRU*/ + fallthrough;case FILEID_INO32_GEN : fid->i32.ino =XFS_I (inode)->i_ino; fid->i32.gen = inode->i_generation;
@@ -92,7 +92,7 @@ xfs_fs_encode_fh(case FILEID_INO32_GEN_PARENT |XFS_FILEID_TYPE_64FLAG : fid64->parent_ino =XFS_I (parent)->i_ino; fid64->parent_gen = parent->i_generation; -/*FALLTHRU*/ + fallthrough;case FILEID_INO32_GEN |XFS_FILEID_TYPE_64FLAG : fid64->ino =XFS_I (inode)->i_ino; fid64->gen = inode->i_generation;
fs/xfs/xfs_file.c +1 -1
@@ -769,7 +769,7 @@ xfs_break_layouts( error =xfs_break_dax_layouts (inode, &retry);if (error || retry)break ; -/* fall through */ + fallthrough;case BREAK_WRITE : error =xfs_break_leased_layouts (inode, iolock, &retry);break ;
fs/xfs/xfs_fsmap.c +1 -1
@@ -100,7 +100,7 @@ xfs_fsmap_owner_to_rmap( dest->rm_owner =XFS_RMAP_OWN_COW ;break ;case XFS_FMR_OWN_DEFECTIVE :/* not implemented */ -/* fall through */ + fallthrough;default :return -EINVAL ; }
fs/xfs/xfs_inode.c +1 -1
@@ -906,7 +906,7 @@ xfs_ialloc(if (pip->i_d.di_flags2 &XFS_DIFLAG2_DAX ) ip->i_d.di_flags2 |=XFS_DIFLAG2_DAX ; } -/* FALLTHROUGH */ + fallthrough;case S_IFLNK : ip->i_df.if_format =XFS_DINODE_FMT_EXTENTS ; ip->i_df.if_flags =XFS_IFEXTENTS ;
fs/xfs/xfs_ioctl.c +2 -2
@@ -557,7 +557,7 @@ xfs_ioc_attrmulti_one(case ATTR_OP_REMOVE : value =NULL ; *len =0 ; -/* fall through */ + fallthrough;case ATTR_OP_SET : error =mnt_want_write_file (parfilp);if (error)
@@ -1660,7 +1660,7 @@ xfs_ioc_getbmap(switch (cmd) {case XFS_IOC_GETBMAPA : bmx.bmv_iflags =BMV_IF_ATTRFORK ; -/*FALLTHRU*/ + fallthrough;case XFS_IOC_GETBMAP :if (file->f_mode &FMODE_NOCMTIME ) bmx.bmv_iflags |=BMV_IF_NO_DMAPI_READ ;
fs/xfs/xfs_iomap.c +1 -1
@@ -1002,7 +1002,7 @@ xfs_buffered_write_iomap_begin( prealloc_blocks =0 ; goto retry; } -/*FALLTHRU*/ + fallthrough;default : goto out_unlock; }
fs/xfs/xfs_trans_buf.c +1 -1
@@ -310,7 +310,7 @@ xfs_trans_read_buf_map(default :if (tp && (tp->t_flags &XFS_TRANS_DIRTY ))xfs_force_shutdown (tp->t_mountp,SHUTDOWN_META_IO_ERROR ); -/* fall through */ + fallthrough;case -ENOMEM :case -EAGAIN :return error;
Quoted 3 lines · Gustavo A. R. Silva
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case.
I don't see any removals, only line changes?
Quoted 1 line
C18??
The kernel hasn't even moved off of C89 onto C99 yet.
Quoted 6 lines
Signed-off-by Gustavo A. R. Silva <[email protected]>--- fs/xfs/libxfs/xfs_ag_resv.c | 4 ++-- fs/xfs/libxfs/xfs_alloc.c | 2 +- fs/xfs/libxfs/xfs_da_btree.c | 2 +- fs/xfs/libxfs/xfs_inode_buf.c | 4 ++--
This is going to cause more churn in xfsprogs...
Quoted 20 lines
fs/xfs/scrub/bmap.c | 2 +- fs/xfs/scrub/btree.c | 2 +- fs/xfs/scrub/common.c | 6 +++--- fs/xfs/scrub/dabtree.c | 2 +- fs/xfs/scrub/repair.c | 2 +- fs/xfs/xfs_bmap_util.c | 2 +- fs/xfs/xfs_export.c | 4 ++-- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_fsmap.c | 2 +- fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_ioctl.c | 4 ++-- fs/xfs/xfs_iomap.c | 2 +- fs/xfs/xfs_trans_buf.c | 2 +- 17 files changed, 23 insertions(+), 23 deletions(-)fs/xfs/libxfs/xfs_ag_resv.c +0
-0
fs/xfs/libxfs/xfs_ag_resv.c xfs_ag_resv_alloc_extent( · line 341
Quoted 5 lines
fs/xfs/libxfs/xfs_ag_resv.c +1
-1@@ -338,7 +338,7 @@ xfs_ag_resv_alloc_extent(break ;default :ASSERT (0 ); -/* fall through */ + fallthrough;
...all so we can increase the number of bloody macros that we have to obscure things. I don't get it, what's the point? Are gcc/clang refusing to support -Wimplicit-fallthrough=[1-4] past a certain date?
--D
Quoted 259 lines
fs/xfs/libxfs/xfs_ag_resv.c +1
-1case XFS_AG_RESV_NONE : field = args->wasdel ?XFS_TRANS_SB_RES_FDBLOCKS :XFS_TRANS_SB_FDBLOCKS ;@@ -380,7 +380,7 @@ xfs_ag_resv_free_extent(break ;default :ASSERT (0 ); -/* fall through */ + fallthrough;case XFS_AG_RESV_NONE :xfs_trans_mod_sb (tp,XFS_TRANS_SB_FDBLOCKS , (int64_t )len);return ;fs/xfs/libxfs/xfs_alloc.c +1
-1@@ -3119,7 +3119,7 @@ xfs_alloc_vextent( } args->agbno =XFS_FSB_TO_AGBNO (mp, args->fsbno); args->type =XFS_ALLOCTYPE_NEAR_BNO ; -/* FALLTHROUGH */ + fallthrough;case XFS_ALLOCTYPE_FIRST_AG :/* * Rotate through the allocation groups looking for a winner. fs/xfs/libxfs/xfs_da_btree.c +1
-1@@ -276,7 +276,7 @@ xfs_da3_node_read_verify( __this_address);break ; } -/* fall through */ + fallthrough;case XFS_DA_NODE_MAGIC : fa =xfs_da3_node_verify (bp);if (fa)fs/xfs/libxfs/xfs_inode_buf.c +2
-2@@ -439,8 +439,8 @@ xfs_dinode_verify_forkoff(if (dip->di_forkoff != (roundup (sizeof (xfs_dev_t),8 ) >>3 ))return __this_address;break ; -case XFS_DINODE_FMT_LOCAL :/* fall through ... */ -case XFS_DINODE_FMT_EXTENTS :/* fall through ... */ +case XFS_DINODE_FMT_LOCAL : +case XFS_DINODE_FMT_EXTENTS :case XFS_DINODE_FMT_BTREE :if (dip->di_forkoff >= (XFS_LITINO (mp) >>3 ))return __this_address;fs/xfs/scrub/bmap.c +1
-1@@ -252,7 +252,7 @@ xchk_bmap_iextent_xref(case XFS_DATA_FORK :if (xfs_is_reflink_inode (info->sc->ip))break ; -/* fall through */ + fallthrough;case XFS_ATTR_FORK :xchk_xref_is_not_shared (info->sc, agbno, irec->br_blockcount);fs/xfs/scrub/btree.c +1
-1@@ -43,7 +43,7 @@ __xchk_btree_process_error(/* Note the badness but don't abort. */ sc->sm->sm_flags |= errflag; *error =0 ; -/* fall through */ + fallthrough;default :if (cur->bc_flags &XFS_BTREE_ROOT_IN_INODE ) trace_xchk_ifork_btree_op_error(sc, cur, level,fs/xfs/scrub/common.c +3
-3@@ -81,7 +81,7 @@ __xchk_process_error(/* Note the badness but don't abort. */ sc->sm->sm_flags |= errflag; *error =0 ; -/* fall through */ + fallthrough;default :trace_xchk_op_error (sc, agno, bno, *error, ret_ip);@@ -134,7 +134,7 @@ __xchk_fblock_process_error(/* Note the badness but don't abort. */ sc->sm->sm_flags |= errflag; *error =0 ; -/* fall through */ + fallthrough;default :trace_xchk_file_op_error (sc, whichfork, offset, *error, ret_ip);@@ -713,7 +713,7 @@ xchk_get_inode(if (error)return -ENOENT ; error = -EFSCORRUPTED ; -/* fall through */ + fallthrough;default : trace_xchk_op_error(sc, XFS_INO_TO_AGNO(mp, sc->sm->sm_ino),fs/xfs/scrub/dabtree.c +1
-1@@ -47,7 +47,7 @@ xchk_da_process_error(/* Note the badness but don't abort. */ sc->sm->sm_flags |=XFS_SCRUB_OFLAG_CORRUPT ; *error =0 ; -/* fall through */ + fallthrough;default : trace_xchk_file_op_error(sc, ds->dargs.whichfork, xfs_dir2_da_to_db(ds->dargs.geo,fs/xfs/scrub/repair.c +1
-1@@ -944,7 +944,7 @@ xrep_ino_dqattach(xrep_force_quotacheck (sc,XFS_DQ_GROUP );if (XFS_IS_PQUOTA_ON (sc->mp) && !sc->ip->i_pdquot)xrep_force_quotacheck (sc,XFS_DQ_PROJ ); -/* fall through */ + fallthrough;case -ESRCH : error =0 ;break ;fs/xfs/xfs_bmap_util.c +1
-1@@ -244,7 +244,7 @@ xfs_bmap_count_blocks(*/ *count += btblocks -1 ; -/* fall through */ + fallthrough;case XFS_DINODE_FMT_EXTENTS : *nextents =xfs_bmap_count_leaves (ifp, count);break ;fs/xfs/xfs_export.c +2
-2@@ -84,7 +84,7 @@ xfs_fs_encode_fh(case FILEID_INO32_GEN_PARENT : fid->i32.parent_ino =XFS_I (parent)->i_ino; fid->i32.parent_gen = parent->i_generation; -/*FALLTHRU*/ + fallthrough;case FILEID_INO32_GEN : fid->i32.ino =XFS_I (inode)->i_ino; fid->i32.gen = inode->i_generation;@@ -92,7 +92,7 @@ xfs_fs_encode_fh(case FILEID_INO32_GEN_PARENT |XFS_FILEID_TYPE_64FLAG : fid64->parent_ino =XFS_I (parent)->i_ino; fid64->parent_gen = parent->i_generation; -/*FALLTHRU*/ + fallthrough;case FILEID_INO32_GEN |XFS_FILEID_TYPE_64FLAG : fid64->ino =XFS_I (inode)->i_ino; fid64->gen = inode->i_generation;fs/xfs/xfs_file.c +1
-1@@ -769,7 +769,7 @@ xfs_break_layouts( error =xfs_break_dax_layouts (inode, &retry);if (error || retry)break ; -/* fall through */ + fallthrough;case BREAK_WRITE : error =xfs_break_leased_layouts (inode, iolock, &retry);break ;fs/xfs/xfs_fsmap.c +1
-1@@ -100,7 +100,7 @@ xfs_fsmap_owner_to_rmap( dest->rm_owner =XFS_RMAP_OWN_COW ;break ;case XFS_FMR_OWN_DEFECTIVE :/* not implemented */ -/* fall through */ + fallthrough;default :return -EINVAL ; }fs/xfs/xfs_inode.c +1
-1@@ -906,7 +906,7 @@ xfs_ialloc(if (pip->i_d.di_flags2 &XFS_DIFLAG2_DAX ) ip->i_d.di_flags2 |=XFS_DIFLAG2_DAX ; } -/* FALLTHROUGH */ + fallthrough;case S_IFLNK : ip->i_df.if_format =XFS_DINODE_FMT_EXTENTS ; ip->i_df.if_flags =XFS_IFEXTENTS ;fs/xfs/xfs_ioctl.c +2
-2@@ -557,7 +557,7 @@ xfs_ioc_attrmulti_one(case ATTR_OP_REMOVE : value =NULL ; *len =0 ; -/* fall through */ + fallthrough;case ATTR_OP_SET : error =mnt_want_write_file (parfilp);if (error)@@ -1660,7 +1660,7 @@ xfs_ioc_getbmap(switch (cmd) {case XFS_IOC_GETBMAPA : bmx.bmv_iflags =BMV_IF_ATTRFORK ; -/*FALLTHRU*/ + fallthrough;case XFS_IOC_GETBMAP :if (file->f_mode &FMODE_NOCMTIME ) bmx.bmv_iflags |=BMV_IF_NO_DMAPI_READ ;fs/xfs/xfs_iomap.c +1
-1@@ -1002,7 +1002,7 @@ xfs_buffered_write_iomap_begin( prealloc_blocks =0 ; goto retry; } -/*FALLTHRU*/ + fallthrough;default : goto out_unlock; }fs/xfs/xfs_trans_buf.c +1
-1@@ -310,7 +310,7 @@ xfs_trans_read_buf_map(default :if (tp && (tp->t_flags &XFS_TRANS_DIRTY ))xfs_force_shutdown (tp->t_mountp,SHUTDOWN_META_IO_ERROR ); -/* fall through */ + fallthrough;case -ENOMEM :case -EAGAIN :return error;
Quoted 4 lines · Darrick J. Wong
Quoted 3 lines · Gustavo A. R. Silva
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case.
[]
Quoted 2 lines
I don't get it, what's the point? Are gcc/clang
refusing to support -Wimplicit-fallthrough=[1-4] past a certain date?
clang doesn't support comments
Quoted 10 lines · Joe Perches
Quoted 4 lines · Darrick J. Wong
Quoted 3 lines · Gustavo A. R. Silva
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case.
[]
Quoted 2 lines
I don't get it, what's the point? Are gcc/clang
refusing to support -Wimplicit-fallthrough=[1-4] past a certain date?clang doesn't support comments
So fix the damn compiler.
-Dave
Signature · 2 lines
Dave Chinner [email protected]