diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-11-28 17:24:35 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-11-28 17:24:35 -0800 |
commit | c2beff99eb03866df6fdbd3a93b08fd27eb8bf5c (patch) | |
tree | c3d0a1f8b6b0750cc5549d0e2a7c749d7d4bc821 /fs/xfs/xfs_error.h | |
parent | 7dd73802f97d2a1602b1cf5c1d6623fb08cb15c5 (diff) | |
download | linux-stable-c2beff99eb03866df6fdbd3a93b08fd27eb8bf5c.tar.gz linux-stable-c2beff99eb03866df6fdbd3a93b08fd27eb8bf5c.tar.bz2 linux-stable-c2beff99eb03866df6fdbd3a93b08fd27eb8bf5c.zip |
xfs: add debug knob to slow down writeback for fun
Add a new error injection knob so that we can arbitrarily slow down
writeback to test for race conditions and aberrant reclaim behavior if
the writeback mechanisms are slow to issue writeback. This will enable
functional testing for the ifork sequence counters introduced in commit
745b3f76d1c8 ("xfs: maintain a sequence count for inode fork
manipulations").
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_error.h')
-rw-r--r-- | fs/xfs/xfs_error.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h index 5191e9145e55..dbe6c37dc697 100644 --- a/fs/xfs/xfs_error.h +++ b/fs/xfs/xfs_error.h @@ -45,6 +45,18 @@ extern bool xfs_errortag_test(struct xfs_mount *mp, const char *expression, const char *file, int line, unsigned int error_tag); #define XFS_TEST_ERROR(expr, mp, tag) \ ((expr) || xfs_errortag_test((mp), #expr, __FILE__, __LINE__, (tag))) +bool xfs_errortag_enabled(struct xfs_mount *mp, unsigned int tag); +#define XFS_ERRORTAG_DELAY(mp, tag) \ + do { \ + might_sleep(); \ + if (!xfs_errortag_enabled((mp), (tag))) \ + break; \ + xfs_warn_ratelimited((mp), \ +"Injecting %ums delay at file %s, line %d, on filesystem \"%s\"", \ + (mp)->m_errortag[(tag)], __FILE__, __LINE__, \ + (mp)->m_super->s_id); \ + mdelay((mp)->m_errortag[(tag)]); \ + } while (0) extern int xfs_errortag_get(struct xfs_mount *mp, unsigned int error_tag); extern int xfs_errortag_set(struct xfs_mount *mp, unsigned int error_tag, @@ -55,6 +67,7 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp); #define xfs_errortag_init(mp) (0) #define xfs_errortag_del(mp) #define XFS_TEST_ERROR(expr, mp, tag) (expr) +#define XFS_ERRORTAG_DELAY(mp, tag) ((void)0) #define xfs_errortag_set(mp, tag, val) (ENOSYS) #define xfs_errortag_add(mp, tag) (ENOSYS) #define xfs_errortag_clearall(mp) (ENOSYS) |