summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 11:15:55 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-12-15 17:29:11 -0800
commitffe7e7772e191c6f9ebbd4ee383fe8e01df3132b (patch)
treec28395b40881030bfc89276b2103ab09e628af0b /fs/xfs/scrub
parent48fb408a0c736ea2c1f5557286de1c7026937267 (diff)
xfs: refactor realtime inode lockingrefactor-rt-locking_2021-12-15
Refactor realtime metadata inode locking so that we can get some sense here. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub')
-rw-r--r--fs/xfs/scrub/common.c7
-rw-r--r--fs/xfs/scrub/fscounters.c4
2 files changed, 5 insertions, 6 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index 6575d5392d0d..615032d69078 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -28,6 +28,7 @@
#include "xfs_reflink.h"
#include "xfs_ag.h"
#include "xfs_error.h"
+#include "xfs_rtalloc.h"
#include "scrub/scrub.h"
#include "scrub/common.h"
#include "scrub/trace.h"
@@ -609,8 +610,7 @@ xchk_rt_init(
struct xfs_scrub *sc,
struct xchk_rt *sr)
{
- xfs_ilock(sc->mp->m_rbmip, XFS_ILOCK_EXCL | XFS_ILOCK_RTBITMAP);
- xfs_ilock(sc->mp->m_rsumip, XFS_ILOCK_EXCL | XFS_ILOCK_RTSUM);
+ xfs_rtlock(NULL, sc->mp, XFS_RTLOCK_ALL);
sr->locked = true;
}
@@ -626,8 +626,7 @@ xchk_rt_unlock(
if (!sr->locked)
return;
- xfs_iunlock(sc->mp->m_rsumip, XFS_ILOCK_EXCL);
- xfs_iunlock(sc->mp->m_rbmip, XFS_ILOCK_EXCL);
+ xfs_rtunlock(sc->mp, XFS_RTLOCK_ALL);
sr->locked = false;
}
diff --git a/fs/xfs/scrub/fscounters.c b/fs/xfs/scrub/fscounters.c
index d231aca7daa6..f7e7ae58b4a4 100644
--- a/fs/xfs/scrub/fscounters.c
+++ b/fs/xfs/scrub/fscounters.c
@@ -316,7 +316,7 @@ xchk_fscount_check_frextents(
}
fsc->frextents = 0;
- xfs_ilock(sc->mp->m_rbmip, XFS_ILOCK_EXCL);
+ xfs_rtlock(NULL, sc->mp, XFS_RTLOCK_ALL);
error = xfs_rtalloc_query_all(sc->tp, xchk_fscount_add_frextent, fsc);
if (error)
goto out_unlock;
@@ -335,7 +335,7 @@ xchk_fscount_check_frextents(
spin_unlock(&mp->m_sb_lock);
out_unlock:
- xfs_iunlock(sc->mp->m_rbmip, XFS_ILOCK_EXCL);
+ xfs_rtunlock(sc->mp, XFS_RTLOCK_ALL);
return error;
}
#else