From ae89e0ab92fcb374e183807a47e6f4013ef7129c Mon Sep 17 00:00:00 2001 From: Dave Chinner Date: Fri, 7 Jan 2011 23:58:50 +1100 Subject: [PATCH] xfstests: 014 takes forever with large preallocation sizes Christoph reported that test 014 went from 7s to 870s runtime with the dynamic speculative delayed allocation changes. Analysis of test 014 shows that it does this loop 10,000 times: pwrite(random offset, 512 bytes); truncate(random offset); Where the random offset is anywhere in a 256MB file. Hence on average every second write or truncate extends the file. If large preallocatione beyond EOF sizes are used each extending write or truncate will zero large numbers of blocks - tens of megabytes at a time. The result is that instead of only writing ~10,000 blocks, we write hundreds to thousands of megabytes of zeros to the file and that is where the difference in runtime is coming from. The IO pattern that this test is using does not reflect a common (or sane!) real-world application IO pattern, so it is really just exercising the allocation and truncation paths in XFS. To do this, we don't need large amounts of preallocation beyond EOF that just slows down the operation, so execute the test with a fixed, small preallocation size that reflects the previous default. By specifying the preallocation size via the allocsize mount option, this also overrides any custom allocsize option provided for the test, so the test will not revert to extremely long runtimes when allocsize is provided on the command line. However, to ensure that we do actually get some coverage of the zeroing paths, set the allocsize mount option to 64k - this exercises the EOF zeroing paths, but does not affect the runtime of the test. Signed-off-by: Dave Chinner Reviewed-by: Alex Elder Reviewed-by: Christoph Hellwig --- 014 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/014 b/014 index a0c04031..e6e0a6f7 100755 --- a/014 +++ b/014 @@ -50,6 +50,12 @@ _supported_os IRIX Linux _require_sparse_files _setup_testdir +# ensure EOF preallocation doesn't massively extend the runtime of this test +# by limiting the amount of preallocation and therefore the amount of blocks +# zeroed during the truncfile test run. +umount $TEST_DIR +_test_mount -o allocsize=64k + echo "brevity is wit..." echo "------" -- 2.30.2