aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-04-25 21:26:23 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2019-04-26 15:28:56 -0400
commit9a1f3049f47330b2467b9eecfc3a3298c46592d1 (patch)
tree17533b55913b335bc4fe50672f366937678c22da
parented30dcbd901c513b63de98278dbd7a6a0dcc50c6 (diff)
xfs: allow scrubbers to pause background reclaim
The forthcoming summary counter patch races with regular filesystem activity to compute rough expected values for the counters. This design was chosen to avoid having to freeze the entire filesystem to check the counters, but while that's running we'd prefer to minimize background reclamation activity to reduce the perturbations to the incore free block count. Therefore, provide a way for scrubbers to disable background posteof and cowblock reclamation. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
-rw-r--r--fs/xfs/scrub/common.c18
-rw-r--r--fs/xfs/scrub/common.h2
-rw-r--r--fs/xfs/scrub/scrub.c2
-rw-r--r--fs/xfs/scrub/scrub.h1
4 files changed, 23 insertions, 0 deletions
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index 7076d5c98151..7d7e91a7bb86 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -894,3 +894,21 @@ xchk_ilock_inverted(
894 } 894 }
895 return -EDEADLOCK; 895 return -EDEADLOCK;
896} 896}
897
898/* Pause background reaping of resources. */
899void
900xchk_stop_reaping(
901 struct xfs_scrub *sc)
902{
903 sc->flags |= XCHK_REAPING_DISABLED;
904 xfs_stop_block_reaping(sc->mp);
905}
906
907/* Restart background reaping of resources. */
908void
909xchk_start_reaping(
910 struct xfs_scrub *sc)
911{
912 xfs_start_block_reaping(sc->mp);
913 sc->flags &= ~XCHK_REAPING_DISABLED;
914}
diff --git a/fs/xfs/scrub/common.h b/fs/xfs/scrub/common.h
index e26a430bd466..84900bfad852 100644
--- a/fs/xfs/scrub/common.h
+++ b/fs/xfs/scrub/common.h
@@ -137,5 +137,7 @@ static inline bool xchk_skip_xref(struct xfs_scrub_metadata *sm)
137 137
138int xchk_metadata_inode_forks(struct xfs_scrub *sc); 138int xchk_metadata_inode_forks(struct xfs_scrub *sc);
139int xchk_ilock_inverted(struct xfs_inode *ip, uint lock_mode); 139int xchk_ilock_inverted(struct xfs_inode *ip, uint lock_mode);
140void xchk_stop_reaping(struct xfs_scrub *sc);
141void xchk_start_reaping(struct xfs_scrub *sc);
140 142
141#endif /* __XFS_SCRUB_COMMON_H__ */ 143#endif /* __XFS_SCRUB_COMMON_H__ */
diff --git a/fs/xfs/scrub/scrub.c b/fs/xfs/scrub/scrub.c
index 93b0f075a4d3..ce13c1c366db 100644
--- a/fs/xfs/scrub/scrub.c
+++ b/fs/xfs/scrub/scrub.c
@@ -187,6 +187,8 @@ xchk_teardown(
187 xfs_irele(sc->ip); 187 xfs_irele(sc->ip);
188 sc->ip = NULL; 188 sc->ip = NULL;
189 } 189 }
190 if (sc->flags & XCHK_REAPING_DISABLED)
191 xchk_start_reaping(sc);
190 if (sc->flags & XCHK_HAS_QUOTAOFFLOCK) { 192 if (sc->flags & XCHK_HAS_QUOTAOFFLOCK) {
191 mutex_unlock(&sc->mp->m_quotainfo->qi_quotaofflock); 193 mutex_unlock(&sc->mp->m_quotainfo->qi_quotaofflock);
192 sc->flags &= ~XCHK_HAS_QUOTAOFFLOCK; 194 sc->flags &= ~XCHK_HAS_QUOTAOFFLOCK;
diff --git a/fs/xfs/scrub/scrub.h b/fs/xfs/scrub/scrub.h
index 1b280f8f185a..01986ed364db 100644
--- a/fs/xfs/scrub/scrub.h
+++ b/fs/xfs/scrub/scrub.h
@@ -80,6 +80,7 @@ struct xfs_scrub {
80/* XCHK state flags grow up from zero, XREP state flags grown down from 2^31 */ 80/* XCHK state flags grow up from zero, XREP state flags grown down from 2^31 */
81#define XCHK_TRY_HARDER (1 << 0) /* can't get resources, try again */ 81#define XCHK_TRY_HARDER (1 << 0) /* can't get resources, try again */
82#define XCHK_HAS_QUOTAOFFLOCK (1 << 1) /* we hold the quotaoff lock */ 82#define XCHK_HAS_QUOTAOFFLOCK (1 << 1) /* we hold the quotaoff lock */
83#define XCHK_REAPING_DISABLED (1 << 2) /* background block reaping paused */
83#define XREP_ALREADY_FIXED (1 << 31) /* checking our repair work */ 84#define XREP_ALREADY_FIXED (1 << 31) /* checking our repair work */
84 85
85/* Metadata scrubbers */ 86/* Metadata scrubbers */