mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
xfs: add zone reset error injection
Add a new errortag to test that zone reset errors are handled correctly. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
committed by
Carlos Maiolino
parent
06873dbd94
commit
41374ae69e
@@ -74,7 +74,8 @@
|
||||
#define XFS_ERRTAG_EXCHMAPS_FINISH_ONE 44
|
||||
#define XFS_ERRTAG_METAFILE_RESV_CRITICAL 45
|
||||
#define XFS_ERRTAG_FORCE_ZERO_RANGE 46
|
||||
#define XFS_ERRTAG_MAX 47
|
||||
#define XFS_ERRTAG_ZONE_RESET 47
|
||||
#define XFS_ERRTAG_MAX 48
|
||||
|
||||
/*
|
||||
* Random factors for above tags, 1 means always, 2 means 1/2 time, etc.
|
||||
@@ -135,7 +136,8 @@ XFS_ERRTAG(WB_DELAY_MS, wb_delay_ms, 3000) \
|
||||
XFS_ERRTAG(WRITE_DELAY_MS, write_delay_ms, 3000) \
|
||||
XFS_ERRTAG(EXCHMAPS_FINISH_ONE, exchmaps_finish_one, 1) \
|
||||
XFS_ERRTAG(METAFILE_RESV_CRITICAL, metafile_resv_crit, 4) \
|
||||
XFS_ERRTAG(FORCE_ZERO_RANGE, force_zero_range, 4)
|
||||
XFS_ERRTAG(FORCE_ZERO_RANGE, force_zero_range, 4) \
|
||||
XFS_ERRTAG(ZONE_RESET, zone_reset, 1)
|
||||
#endif /* XFS_ERRTAG */
|
||||
|
||||
#endif /* __XFS_ERRORTAG_H_ */
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "xfs_rmap.h"
|
||||
#include "xfs_rtbitmap.h"
|
||||
#include "xfs_rtrmap_btree.h"
|
||||
#include "xfs_errortag.h"
|
||||
#include "xfs_error.h"
|
||||
#include "xfs_zone_alloc.h"
|
||||
#include "xfs_zone_priv.h"
|
||||
#include "xfs_zones.h"
|
||||
@@ -898,9 +900,17 @@ xfs_submit_zone_reset_bio(
|
||||
struct xfs_rtgroup *rtg,
|
||||
struct bio *bio)
|
||||
{
|
||||
struct xfs_mount *mp = rtg_mount(rtg);
|
||||
|
||||
trace_xfs_zone_reset(rtg);
|
||||
|
||||
ASSERT(rtg_rmap(rtg)->i_used_blocks == 0);
|
||||
|
||||
if (XFS_TEST_ERROR(mp, XFS_ERRTAG_ZONE_RESET)) {
|
||||
bio_io_error(bio);
|
||||
return;
|
||||
}
|
||||
|
||||
bio->bi_iter.bi_sector = xfs_gbno_to_daddr(&rtg->rtg_group, 0);
|
||||
if (!bdev_zone_is_seq(bio->bi_bdev, bio->bi_iter.bi_sector)) {
|
||||
/*
|
||||
@@ -913,8 +923,7 @@ xfs_submit_zone_reset_bio(
|
||||
}
|
||||
bio->bi_opf &= ~REQ_OP_ZONE_RESET;
|
||||
bio->bi_opf |= REQ_OP_DISCARD;
|
||||
bio->bi_iter.bi_size =
|
||||
XFS_FSB_TO_B(rtg_mount(rtg), rtg_blocks(rtg));
|
||||
bio->bi_iter.bi_size = XFS_FSB_TO_B(mp, rtg_blocks(rtg));
|
||||
}
|
||||
|
||||
submit_bio(bio);
|
||||
|
||||
Reference in New Issue
Block a user