summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2026-01-30 06:19:19 +0100
committerCarlos Maiolino <cem@kernel.org>2026-01-30 10:41:42 +0100
commite2d62bfd99b6b79d7c5a4c543c2d84049f01f24f (patch)
tree31dc2481a904a02bd387ff174462d25251d5a669
parentb8862a09d8256a9037293f1da3b4617b21de26f1 (diff)
xfs: move the guts of XFS_ERRORTAG_DELAY out of line
Mirror what is done for the more common XFS_ERRORTAG_TEST version, and also only look at the error tag value once now that we can easily have a local variable. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r--fs/xfs/xfs_error.c21
-rw-r--r--fs/xfs/xfs_error.h15
2 files changed, 24 insertions, 12 deletions
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 52a1d51126e3..a6f160a4d0e9 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -144,6 +144,27 @@ xfs_errortag_test(
return true;
}
+void
+xfs_errortag_delay(
+ struct xfs_mount *mp,
+ const char *file,
+ int line,
+ unsigned int error_tag)
+{
+ unsigned int delay = mp->m_errortag[error_tag];
+
+ might_sleep();
+
+ if (!delay)
+ return;
+
+ xfs_warn_ratelimited(mp,
+"Injecting %ums delay at file %s, line %d, on filesystem \"%s\"",
+ delay, file, line,
+ mp->m_super->s_id);
+ mdelay(delay);
+}
+
int
xfs_errortag_add(
struct xfs_mount *mp,
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index ec22546a8ca8..b40e7c671d2a 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -40,19 +40,10 @@ bool xfs_errortag_test(struct xfs_mount *mp, const char *file, int line,
unsigned int error_tag);
#define XFS_TEST_ERROR(mp, tag) \
xfs_errortag_test((mp), __FILE__, __LINE__, (tag))
-bool xfs_errortag_enabled(struct xfs_mount *mp, unsigned int tag);
+void xfs_errortag_delay(struct xfs_mount *mp, const char *file, int line,
+ unsigned int error_tag);
#define XFS_ERRORTAG_DELAY(mp, tag) \
- do { \
- might_sleep(); \
- if (!mp->m_errortag[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)
-
+ xfs_errortag_delay((mp), __FILE__, __LINE__, (tag))
int xfs_errortag_add(struct xfs_mount *mp, unsigned int error_tag);
int xfs_errortag_clearall(struct xfs_mount *mp);
#else