Skip to content

Commit

Permalink
xfs: replace XFS_FORCED_SHUTDOWN with xfs_is_shutdown
Browse files Browse the repository at this point in the history
Remove the shouty macro and instead use the inline function that
matches other state/feature check wrapper naming. This conversion
was done with sed.

Signed-off-by: Dave Chinner <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>
  • Loading branch information
Dave Chinner authored and Darrick J. Wong committed Aug 19, 2021
1 parent 2e973b2 commit 75c8c50
Show file tree
Hide file tree
Showing 29 changed files with 90 additions and 90 deletions.
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3079,7 +3079,7 @@ xfs_alloc_read_agf(
atomic64_add(allocbt_blks, &mp->m_allocbt_blks);
}
#ifdef DEBUG
else if (!XFS_FORCED_SHUTDOWN(mp)) {
else if (!xfs_is_shutdown(mp)) {
ASSERT(pag->pagf_freeblks == be32_to_cpu(agf->agf_freeblks));
ASSERT(pag->pagf_btreeblks == be32_to_cpu(agf->agf_btreeblks));
ASSERT(pag->pagf_flcount == be32_to_cpu(agf->agf_flcount));
Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/libxfs/xfs_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ xfs_attr_get(

XFS_STATS_INC(args->dp->i_mount, xs_attr_get);

if (XFS_FORCED_SHUTDOWN(args->dp->i_mount))
if (xfs_is_shutdown(args->dp->i_mount))
return -EIO;

args->geo = args->dp->i_mount->m_attr_geo;
Expand Down Expand Up @@ -710,7 +710,7 @@ xfs_attr_set(
int rmt_blks = 0;
unsigned int total;

if (XFS_FORCED_SHUTDOWN(dp->i_mount))
if (xfs_is_shutdown(dp->i_mount))
return -EIO;

error = xfs_qm_dqattach(dp);
Expand Down
16 changes: 8 additions & 8 deletions fs/xfs/libxfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3938,7 +3938,7 @@ xfs_bmapi_read(
XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BMAPIFORMAT))
return -EFSCORRUPTED;

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

XFS_STATS_INC(mp, xs_blk_mapr);
Expand Down Expand Up @@ -4420,7 +4420,7 @@ xfs_bmapi_write(
return -EFSCORRUPTED;
}

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

XFS_STATS_INC(mp, xs_blk_mapw);
Expand Down Expand Up @@ -4703,7 +4703,7 @@ xfs_bmapi_remap(
return -EFSCORRUPTED;
}

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

error = xfs_iread_extents(tp, ip, whichfork);
Expand Down Expand Up @@ -5361,7 +5361,7 @@ __xfs_bunmapi(
ifp = XFS_IFORK_PTR(ip, whichfork);
if (XFS_IS_CORRUPT(mp, !xfs_ifork_has_extents(ifp)))
return -EFSCORRUPTED;
if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
Expand Down Expand Up @@ -5852,7 +5852,7 @@ xfs_bmap_collapse_extents(
return -EFSCORRUPTED;
}

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL));
Expand Down Expand Up @@ -5930,7 +5930,7 @@ xfs_bmap_can_insert_extents(

ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL));

if (XFS_FORCED_SHUTDOWN(ip->i_mount))
if (xfs_is_shutdown(ip->i_mount))
return -EIO;

xfs_ilock(ip, XFS_ILOCK_EXCL);
Expand Down Expand Up @@ -5967,7 +5967,7 @@ xfs_bmap_insert_extents(
return -EFSCORRUPTED;
}

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL));
Expand Down Expand Up @@ -6070,7 +6070,7 @@ xfs_bmap_split_extent(
return -EFSCORRUPTED;
}

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

/* Read in all the extents */
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ xfs_btree_del_cursor(
}

ASSERT(cur->bc_btnum != XFS_BTNUM_BMAP || cur->bc_ino.allocated == 0 ||
XFS_FORCED_SHUTDOWN(cur->bc_mp));
xfs_is_shutdown(cur->bc_mp));
if (unlikely(cur->bc_flags & XFS_BTREE_STAGING))
kmem_free(cur->bc_ops);
if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS) && cur->bc_ag.pag)
Expand Down
6 changes: 3 additions & 3 deletions fs/xfs/libxfs/xfs_ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ xfs_check_agi_freecount(
}
} while (i == 1);

if (!XFS_FORCED_SHUTDOWN(cur->bc_mp))
if (!xfs_is_shutdown(cur->bc_mp))
ASSERT(freecount == cur->bc_ag.pag->pagi_freecount);
}
return 0;
Expand Down Expand Up @@ -1784,7 +1784,7 @@ xfs_dialloc(
break;
}

if (XFS_FORCED_SHUTDOWN(mp)) {
if (xfs_is_shutdown(mp)) {
error = -EFSCORRUPTED;
break;
}
Expand Down Expand Up @@ -2624,7 +2624,7 @@ xfs_ialloc_read_agi(
* we are in the middle of a forced shutdown.
*/
ASSERT(pag->pagi_freecount == be32_to_cpu(agi->agi_freecount) ||
XFS_FORCED_SHUTDOWN(mp));
xfs_is_shutdown(mp));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/scrub/scrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ xfs_scrub_metadata(

/* Forbidden if we are shut down or mounted norecovery. */
error = -ESHUTDOWN;
if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
goto out;
error = -ENOTRECOVERABLE;
if (xfs_has_norecovery(mp))
Expand Down
8 changes: 4 additions & 4 deletions fs/xfs/xfs_aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ xfs_end_ioend(
/*
* Just clean up the in-memory structures if the fs has been shut down.
*/
if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
if (xfs_is_shutdown(ip->i_mount)) {
error = -EIO;
goto done;
}
Expand Down Expand Up @@ -260,7 +260,7 @@ xfs_map_blocks(
int retries = 0;
int error = 0;

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

/*
Expand Down Expand Up @@ -440,7 +440,7 @@ xfs_discard_page(
xfs_fileoff_t pageoff_fsb = XFS_B_TO_FSBT(mp, pageoff);
int error;

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
goto out_invalidate;

xfs_alert_ratelimited(mp,
Expand All @@ -449,7 +449,7 @@ xfs_discard_page(

error = xfs_bmap_punch_delalloc_range(ip, start_fsb,
i_blocks_per_page(inode, page) - pageoff_fsb);
if (error && !XFS_FORCED_SHUTDOWN(mp))
if (error && !xfs_is_shutdown(mp))
xfs_alert(mp, "page discard unable to remove delalloc mapping.");
out_invalidate:
iomap_invalidatepage(page, pageoff, PAGE_SIZE - pageoff);
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_attr_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ xfs_attr_list(

XFS_STATS_INC(dp->i_mount, xs_attr_list);

if (XFS_FORCED_SHUTDOWN(dp->i_mount))
if (xfs_is_shutdown(dp->i_mount))
return -EIO;

lock_mode = xfs_ilock_attr_map_shared(dp);
Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/xfs_bmap_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ xfs_free_eofblocks(

error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
if (error) {
ASSERT(XFS_FORCED_SHUTDOWN(mp));
ASSERT(xfs_is_shutdown(mp));
return error;
}

Expand Down Expand Up @@ -789,7 +789,7 @@ xfs_alloc_file_space(

trace_xfs_alloc_file_space(ip);

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

error = xfs_qm_dqattach(ip);
Expand Down
8 changes: 4 additions & 4 deletions fs/xfs/xfs_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ xfs_buf_read_map(
* buffer.
*/
if (error) {
if (!XFS_FORCED_SHUTDOWN(target->bt_mount))
if (!xfs_is_shutdown(target->bt_mount))
xfs_buf_ioerror_alert(bp, fa);

bp->b_flags &= ~XBF_DONE;
Expand Down Expand Up @@ -1178,7 +1178,7 @@ xfs_buf_ioend_handle_error(
* If we've already decided to shutdown the filesystem because of I/O
* errors, there's no point in giving this a retry.
*/
if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
goto out_stale;

xfs_buf_ioerror_alert_ratelimited(bp);
Expand Down Expand Up @@ -1591,7 +1591,7 @@ __xfs_buf_submit(
ASSERT(!(bp->b_flags & _XBF_DELWRI_Q));

/* on shutdown we stale and complete the buffer immediately */
if (XFS_FORCED_SHUTDOWN(bp->b_mount)) {
if (xfs_is_shutdown(bp->b_mount)) {
xfs_buf_ioend_fail(bp);
return -EIO;
}
Expand Down Expand Up @@ -1808,7 +1808,7 @@ xfs_buftarg_drain(
* down the fs.
*/
if (write_fail) {
ASSERT(XFS_FORCED_SHUTDOWN(btp->bt_mount));
ASSERT(xfs_is_shutdown(btp->bt_mount));
xfs_alert(btp->bt_mount,
"Please run xfs_repair to determine the extent of the problem.");
}
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_buf_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ xfs_buf_item_put(
* that case, the bli is freed on buffer writeback completion.
*/
aborted = test_bit(XFS_LI_ABORTED, &lip->li_flags) ||
XFS_FORCED_SHUTDOWN(lip->li_mountp);
xfs_is_shutdown(lip->li_mountp);
dirty = bip->bli_flags & XFS_BLI_DIRTY;
if (dirty && !aborted)
return false;
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_dir2_readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ xfs_readdir(

trace_xfs_readdir(dp);

if (XFS_FORCED_SHUTDOWN(dp->i_mount))
if (xfs_is_shutdown(dp->i_mount))
return -EIO;

ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
Expand Down
14 changes: 7 additions & 7 deletions fs/xfs/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ xfs_file_fsync(
if (error)
return error;

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

xfs_iflags_clear(ip, XFS_ITRUNCATED);
Expand Down Expand Up @@ -318,7 +318,7 @@ xfs_file_read_iter(

XFS_STATS_INC(mp, xs_read_calls);

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

if (IS_DAX(inode))
Expand Down Expand Up @@ -462,7 +462,7 @@ xfs_dio_write_end_io(

trace_xfs_end_io_direct_write(ip, offset, size);

if (XFS_FORCED_SHUTDOWN(ip->i_mount))
if (xfs_is_shutdown(ip->i_mount))
return -EIO;

if (error)
Expand Down Expand Up @@ -814,7 +814,7 @@ xfs_file_write_iter(
if (ocount == 0)
return 0;

if (XFS_FORCED_SHUTDOWN(ip->i_mount))
if (xfs_is_shutdown(ip->i_mount))
return -EIO;

if (IS_DAX(inode))
Expand Down Expand Up @@ -1156,7 +1156,7 @@ xfs_file_remap_range(
if (!xfs_has_reflink(mp))
return -EOPNOTSUPP;

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return -EIO;

/* Prepare and then clone file data. */
Expand Down Expand Up @@ -1205,7 +1205,7 @@ xfs_file_open(
{
if (!(file->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
return -EFBIG;
if (XFS_FORCED_SHUTDOWN(XFS_M(inode->i_sb)))
if (xfs_is_shutdown(XFS_M(inode->i_sb)))
return -EIO;
file->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC;
return 0;
Expand Down Expand Up @@ -1277,7 +1277,7 @@ xfs_file_llseek(
{
struct inode *inode = file->f_mapping->host;

if (XFS_FORCED_SHUTDOWN(XFS_I(inode)->i_mount))
if (xfs_is_shutdown(XFS_I(inode)->i_mount))
return -EIO;

switch (whence) {
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_health.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ xfs_health_unmount(
unsigned int checked = 0;
bool warn = false;

if (XFS_FORCED_SHUTDOWN(mp))
if (xfs_is_shutdown(mp))
return;

/* Measure AG corruption levels. */
Expand Down
8 changes: 4 additions & 4 deletions fs/xfs/xfs_icache.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ xfs_reclaim_inode(
if (xfs_iflags_test_and_set(ip, XFS_IFLUSHING))
goto out_iunlock;

if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
if (xfs_is_shutdown(ip->i_mount)) {
xfs_iunpin_wait(ip);
xfs_iflush_abort(ip);
goto reclaim;
Expand Down Expand Up @@ -968,7 +968,7 @@ xfs_want_reclaim_sick(
struct xfs_mount *mp)
{
return xfs_is_unmounting(mp) || xfs_has_norecovery(mp) ||
XFS_FORCED_SHUTDOWN(mp);
xfs_is_shutdown(mp);
}

void
Expand Down Expand Up @@ -1414,7 +1414,7 @@ xfs_blockgc_igrab(
spin_unlock(&ip->i_flags_lock);

/* nothing to sync during shutdown */
if (XFS_FORCED_SHUTDOWN(ip->i_mount))
if (xfs_is_shutdown(ip->i_mount))
return false;

/* If we can't grab the inode, it must on it's way to reclaim. */
Expand Down Expand Up @@ -1811,7 +1811,7 @@ xfs_inodegc_set_reclaimable(
struct xfs_mount *mp = ip->i_mount;
struct xfs_perag *pag;

if (!XFS_FORCED_SHUTDOWN(mp) && ip->i_delayed_blks) {
if (!xfs_is_shutdown(mp) && ip->i_delayed_blks) {
xfs_check_delalloc(ip, XFS_DATA_FORK);
xfs_check_delalloc(ip, XFS_COW_FORK);
ASSERT(0);
Expand Down
Loading

0 comments on commit 75c8c50

Please sign in to comment.