xfsqa: make hole tests independent of speculative allocation patterns
PATCH 1/1 xfsqa: make hole tests independent of speculative allocation patterns
From: Dave Chinner <[email protected]>
Many of the "count-the-holes" tests (008, 012, etc) do writes that extend the file and hence allocation patterns are dependent on speculative allocation beyond EOF behaviour. Hence if we change that behaviour, these tests all fail because there is a different pattern of holes.
Make the tests independent of EOF preallocation behaviour by first truncating the file to the size the test is defined to use. This prevents speculative prealocation from occurring, and hence changes in such behaviour will not cause the tests to fail.
--- 203 | 4 ++++ src/holes.c | 11 +++++++++++ src/randholes.c | 10 ++++++++++ 3 files changed, 25 insertions(+), 0 deletions(-)
203 +4 -0
@@ -36,6 +36,10 @@ _write_holes() file=$1 holes=$2 let writes=$holes+1 + let fsize=$(($writes * 0x100000)) + + # prevent EOF preallocation from affecting results + xfs_io -f $file -c "truncate $fsize" offset=0 for i in `seq 0 $writes`; do
src/holes.c +11 -0
@@ -79,6 +79,17 @@ main(int argc, char *argv[])perror ("open" );return 1 ; } + +/* +* Avoid allocation patterns being perturbed by different speculative +* preallocation beyond EOF configurations by first truncating the file +* to the expected maximum file size. +*/ +if (ftruncate (fd, filesize) <0 ) { +perror ("ftruncate" ); +exit (EXIT_FAILURE ); + } +for (i =0 ; i < count; i++) {writeblks (fd, filesize, blocksize, interleave, i, rev); }
src/randholes.c +10 -0
@@ -208,6 +208,16 @@ writeblks(char *fname, int fd, size_t alignment)memset (buffer,0 , blocksize); } +/* +* Avoid allocation patterns being perturbed by different speculative +* preallocation beyond EOF configurations by first truncating the file +* to the expected maximum file size. +*/ +if (ftruncate (fd, filesize) <0 ) { +perror ("ftruncate" ); +exit (EXIT_FAILURE ); + } + do { if (verbose && ((count % 100) == 0)) { printf(".");
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Many of the "count-the-holes" tests (008, 012, etc) do writes that extend the file and hence allocation patterns are dependent on speculative allocation beyond EOF behaviour. Hence if we change that behaviour, these tests all fail because there is a different pattern of holes.
Quoted 6 lines
Make the tests independent of EOF preallocation behaviour by first truncating the file to the size the test is defined to use. This prevents speculative prealocation from occurring, and hence changes in such behaviour will not cause the tests to fail.
Signed-off-by Dave Chinner <[email protected]>
Looks good and fixes the test failure I saw with the dirty release counter patch.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs