Skip to content

Commit ca57120

Browse files
johnpgarryChandan Babu R
authored andcommitted
xfs: Use xfs set and clear mp state helpers
Use the set and clear mp state helpers instead of open-coding. It is noted that in some instances calls to atomic operation set_bit() and clear_bit() are being replaced with test_and_set_bit() and test_and_clear_bit(), respectively, as there is no specific helpers for set_bit() and clear_bit() only. However should be ok, as we are just ignoring the returned value from those "test" variants. Signed-off-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
1 parent 9372dce commit ca57120

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

fs/xfs/xfs_fsops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ xfs_do_force_shutdown(
485485
const char *why;
486486

487487

488-
if (test_and_set_bit(XFS_OPSTATE_SHUTDOWN, &mp->m_opstate)) {
488+
if (xfs_set_shutdown(mp)) {
489489
xlog_shutdown_wait(mp->m_log);
490490
return;
491491
}

fs/xfs/xfs_log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3495,7 +3495,7 @@ xlog_force_shutdown(
34953495
* If this log shutdown also sets the mount shutdown state, issue a
34963496
* shutdown warning message.
34973497
*/
3498-
if (!test_and_set_bit(XFS_OPSTATE_SHUTDOWN, &log->l_mp->m_opstate)) {
3498+
if (!xfs_set_shutdown(log->l_mp)) {
34993499
xfs_alert_tag(log->l_mp, XFS_PTAG_SHUTDOWN_LOGERROR,
35003500
"Filesystem has been shut down due to log error (0x%x).",
35013501
shutdown_flags);

fs/xfs/xfs_log_recover.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ xlog_find_tail(
13361336
* headers if we have a filesystem using non-persistent counters.
13371337
*/
13381338
if (clean)
1339-
set_bit(XFS_OPSTATE_CLEAN, &log->l_mp->m_opstate);
1339+
xfs_set_clean(log->l_mp);
13401340

13411341
/*
13421342
* Make sure that there are no blocks in front of the head

fs/xfs/xfs_mount.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ xfs_unmount_flush_inodes(
595595
xfs_extent_busy_wait_all(mp);
596596
flush_workqueue(xfs_discard_wq);
597597

598-
set_bit(XFS_OPSTATE_UNMOUNTING, &mp->m_opstate);
598+
xfs_set_unmounting(mp);
599599

600600
xfs_ail_push_all_sync(mp->m_ail);
601601
xfs_inodegc_stop(mp);

fs/xfs/xfs_super.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ xfs_set_inode_alloc(
311311
* the allocator to accommodate the request.
312312
*/
313313
if (xfs_has_small_inums(mp) && ino > XFS_MAXINUMBER_32)
314-
set_bit(XFS_OPSTATE_INODE32, &mp->m_opstate);
314+
xfs_set_inode32(mp);
315315
else
316-
clear_bit(XFS_OPSTATE_INODE32, &mp->m_opstate);
316+
xfs_clear_inode32(mp);
317317

318318
for (index = 0; index < agcount; index++) {
319319
struct xfs_perag *pag;
@@ -1511,7 +1511,7 @@ xfs_fs_fill_super(
15111511
* the newer fsopen/fsconfig API.
15121512
*/
15131513
if (fc->sb_flags & SB_RDONLY)
1514-
set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
1514+
xfs_set_readonly(mp);
15151515
if (fc->sb_flags & SB_DIRSYNC)
15161516
mp->m_features |= XFS_FEAT_DIRSYNC;
15171517
if (fc->sb_flags & SB_SYNCHRONOUS)
@@ -1820,7 +1820,7 @@ xfs_remount_rw(
18201820
return -EINVAL;
18211821
}
18221822

1823-
clear_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
1823+
xfs_clear_readonly(mp);
18241824

18251825
/*
18261826
* If this is the first remount to writeable state we might have some
@@ -1908,7 +1908,7 @@ xfs_remount_ro(
19081908
xfs_save_resvblks(mp);
19091909

19101910
xfs_log_clean(mp);
1911-
set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
1911+
xfs_set_readonly(mp);
19121912

19131913
return 0;
19141914
}

0 commit comments

Comments
 (0)