From: Darrick J. Wong Date: Tue, 25 Oct 2016 01:46:51 +0000 (+1100) Subject: xfs: simulate per-AG reservations being critically low X-Git-Tag: v4.9.0-rc1~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7bf13987fdbf317de6cfc801c914f2af46b7669;p=thirdparty%2Fxfsprogs-dev.git xfs: simulate per-AG reservations being critically low Source kernel commit: a35eb41519ab8db90e87d375ee9362d6e080ca4c 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 Reviewed-by: Christoph Hellwig --- diff --git a/libxfs/xfs_ag_resv.c b/libxfs/xfs_ag_resv.c index 7e03328f9..57f01a74b 100644 --- a/libxfs/xfs_ag_resv.c +++ b/libxfs/xfs_ag_resv.c @@ -108,7 +108,9 @@ xfs_ag_resv_critical( trace_xfs_ag_resv_critical(pag, type, avail); /* Critically low if less than 10% or max btree height remains. */ - return avail < orig / 10 || avail < XFS_BTREE_MAXLEVELS; + return XFS_TEST_ERROR(avail < orig / 10 || avail < XFS_BTREE_MAXLEVELS, + pag->pag_mount, XFS_ERRTAG_AG_RESV_CRITICAL, + XFS_RANDOM_AG_RESV_CRITICAL); } /*