diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2016-10-03 12:11:51 -0400 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2016-10-05 19:26:31 -0400 |
commit | a35eb41519ab8db90e87d375ee9362d6e080ca4c (patch) | |
tree | 6db45615c97decf9d8c75bbc8c590e0ca5d936b2 | |
parent | 4f435ebe7d0422af61cdcddbbcc659888645a1e1 (diff) |
xfs: simulate per-AG reservations being critically low
Create an error injection point that enables us to simulate being
critically low on per-AG block reservations. This should enable us to
simulate this specific ENOSPC condition so that we can test falling back
to a regular file copy.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | fs/xfs/libxfs/xfs_ag_resv.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_error.h | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_ag_resv.c b/fs/xfs/libxfs/xfs_ag_resv.c index adf770f0d011..e5ebc3770460 100644 --- a/fs/xfs/libxfs/xfs_ag_resv.c +++ b/fs/xfs/libxfs/xfs_ag_resv.c | |||
@@ -109,7 +109,9 @@ xfs_ag_resv_critical( | |||
109 | trace_xfs_ag_resv_critical(pag, type, avail); | 109 | trace_xfs_ag_resv_critical(pag, type, avail); |
110 | 110 | ||
111 | /* Critically low if less than 10% or max btree height remains. */ | 111 | /* Critically low if less than 10% or max btree height remains. */ |
112 | return avail < orig / 10 || avail < XFS_BTREE_MAXLEVELS; | 112 | return XFS_TEST_ERROR(avail < orig / 10 || avail < XFS_BTREE_MAXLEVELS, |
113 | pag->pag_mount, XFS_ERRTAG_AG_RESV_CRITICAL, | ||
114 | XFS_RANDOM_AG_RESV_CRITICAL); | ||
113 | } | 115 | } |
114 | 116 | ||
115 | /* | 117 | /* |
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h index 8d8e1b07d295..05f8666733a0 100644 --- a/fs/xfs/xfs_error.h +++ b/fs/xfs/xfs_error.h | |||
@@ -95,7 +95,8 @@ extern void xfs_verifier_error(struct xfs_buf *bp); | |||
95 | #define XFS_ERRTAG_REFCOUNT_CONTINUE_UPDATE 24 | 95 | #define XFS_ERRTAG_REFCOUNT_CONTINUE_UPDATE 24 |
96 | #define XFS_ERRTAG_REFCOUNT_FINISH_ONE 25 | 96 | #define XFS_ERRTAG_REFCOUNT_FINISH_ONE 25 |
97 | #define XFS_ERRTAG_BMAP_FINISH_ONE 26 | 97 | #define XFS_ERRTAG_BMAP_FINISH_ONE 26 |
98 | #define XFS_ERRTAG_MAX 27 | 98 | #define XFS_ERRTAG_AG_RESV_CRITICAL 27 |
99 | #define XFS_ERRTAG_MAX 28 | ||
99 | 100 | ||
100 | /* | 101 | /* |
101 | * Random factors for above tags, 1 means always, 2 means 1/2 time, etc. | 102 | * Random factors for above tags, 1 means always, 2 means 1/2 time, etc. |
@@ -127,6 +128,7 @@ extern void xfs_verifier_error(struct xfs_buf *bp); | |||
127 | #define XFS_RANDOM_REFCOUNT_CONTINUE_UPDATE 1 | 128 | #define XFS_RANDOM_REFCOUNT_CONTINUE_UPDATE 1 |
128 | #define XFS_RANDOM_REFCOUNT_FINISH_ONE 1 | 129 | #define XFS_RANDOM_REFCOUNT_FINISH_ONE 1 |
129 | #define XFS_RANDOM_BMAP_FINISH_ONE 1 | 130 | #define XFS_RANDOM_BMAP_FINISH_ONE 1 |
131 | #define XFS_RANDOM_AG_RESV_CRITICAL 4 | ||
130 | 132 | ||
131 | #ifdef DEBUG | 133 | #ifdef DEBUG |
132 | extern int xfs_error_test_active; | 134 | extern int xfs_error_test_active; |