Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Christoph Hellwig and committed by
Carlos Maiolino
e2d62bfd b8862a09

+24 -12
+21
fs/xfs/xfs_error.c
··· 144 144 return true; 145 145 } 146 146 147 + void 148 + xfs_errortag_delay( 149 + struct xfs_mount *mp, 150 + const char *file, 151 + int line, 152 + unsigned int error_tag) 153 + { 154 + unsigned int delay = mp->m_errortag[error_tag]; 155 + 156 + might_sleep(); 157 + 158 + if (!delay) 159 + return; 160 + 161 + xfs_warn_ratelimited(mp, 162 + "Injecting %ums delay at file %s, line %d, on filesystem \"%s\"", 163 + delay, file, line, 164 + mp->m_super->s_id); 165 + mdelay(delay); 166 + } 167 + 147 168 int 148 169 xfs_errortag_add( 149 170 struct xfs_mount *mp,
+3 -12
fs/xfs/xfs_error.h
··· 40 40 unsigned int error_tag); 41 41 #define XFS_TEST_ERROR(mp, tag) \ 42 42 xfs_errortag_test((mp), __FILE__, __LINE__, (tag)) 43 - bool xfs_errortag_enabled(struct xfs_mount *mp, unsigned int tag); 43 + void xfs_errortag_delay(struct xfs_mount *mp, const char *file, int line, 44 + unsigned int error_tag); 44 45 #define XFS_ERRORTAG_DELAY(mp, tag) \ 45 - do { \ 46 - might_sleep(); \ 47 - if (!mp->m_errortag[tag]) \ 48 - break; \ 49 - xfs_warn_ratelimited((mp), \ 50 - "Injecting %ums delay at file %s, line %d, on filesystem \"%s\"", \ 51 - (mp)->m_errortag[(tag)], __FILE__, __LINE__, \ 52 - (mp)->m_super->s_id); \ 53 - mdelay((mp)->m_errortag[(tag)]); \ 54 - } while (0) 55 - 46 + xfs_errortag_delay((mp), __FILE__, __LINE__, (tag)) 56 47 int xfs_errortag_add(struct xfs_mount *mp, unsigned int error_tag); 57 48 int xfs_errortag_clearall(struct xfs_mount *mp); 58 49 #else