_test_generic_punch: Extend $testfile's size to work with 64k block.
PATCH 1/1 _test_generic_punch: Extend $testfile's size to work with 64k block.
Quoted 1 line
From
cf6e1fc3a8d7806a97055b5f483cf50f58c8294fMon Sep 17 00:00:00 2001
From: chandan <[email protected]>
Date: Thu, 8 Aug 2013 11:33:10 +0530
Subject: [PATCH] _test_generic_punch: Extend $testfile's size to work with 64k
block.
The current script does not work with 64k block size. This patch fixes it by creating a larger $testfile.
--- common/punch | 119 +++++++------ tests/generic/255.out | 476 +++++++++++++++++++++++++------------------------- tests/xfs/242.out | 118 ++++++------- tests/xfs/252.out | 476 +++++++++++++++++++++++++------------------------- 4 files changed, 594 insertions(+), 595 deletions(-)
common/punch +59 -60
@@ -316,8 +316,8 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "$zero_cmd 4k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "$zero_cmd 64k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -326,9 +326,9 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "pwrite 0 20k" $sync_cmd \ - -c "$zero_cmd 4k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "pwrite 0 320k" $sync_cmd \ + -c "$zero_cmd 64k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -337,9 +337,9 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "$alloc_cmd 0 20k" \ - -c "$zero_cmd 4k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "$alloc_cmd 0 320k" \ + -c "$zero_cmd 64k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -348,9 +348,9 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "pwrite 8k 8k" $sync_cmd \ - -c "$zero_cmd 4k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "pwrite 128k 128k" $sync_cmd \ + -c "$zero_cmd 64k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -359,9 +359,9 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "$alloc_cmd 8k 8k" \ - -c "$zero_cmd 4k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "$alloc_cmd 128k 128k" \ + -c "$zero_cmd 64k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -370,9 +370,9 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "pwrite 0 8k" $sync_cmd \ - -c "$zero_cmd 4k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "pwrite 0 128k" $sync_cmd \ + -c "$zero_cmd 64k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -381,10 +381,10 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "pwrite 0 8k" $sync_cmd \ - -c "$alloc_cmd 8k 8k" \ - -c "$zero_cmd 4k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "pwrite 0 128k" $sync_cmd \ + -c "$alloc_cmd 128k 128k" \ + -c "$zero_cmd 64k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -393,9 +393,9 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "$alloc_cmd 0 8k" \ - -c "$zero_cmd 4k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "$alloc_cmd 0 128k" \ + -c "$zero_cmd 64k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -404,10 +404,10 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "$alloc_cmd 0 8k" \ - -c "pwrite 8k 8k" $sync_cmd \ - -c "$zero_cmd 4k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "$alloc_cmd 0 128k" \ + -c "pwrite 128k 128k" $sync_cmd \ + -c "$zero_cmd 64k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -416,9 +416,9 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "pwrite 8k 4k" $sync_cmd \ - -c "$zero_cmd 4k 12k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "pwrite 128k 64k" $sync_cmd \ + -c "$zero_cmd 64k 192k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -427,12 +427,12 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "$alloc_cmd 0 20k" \ - -c "pwrite 0 8k" \ - -c "pwrite 12k 8k" $sync_cmd \ - -c "$punch_cmd 8k 4k" \ - -c "$zero_cmd 4k 12k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "$alloc_cmd 0 320k" \ + -c "pwrite 0 128k" \ + -c "pwrite 192k 128k" $sync_cmd \ + -c "$punch_cmd 128k 64k" \ + -c "$zero_cmd 64k 192k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -441,10 +441,10 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "$alloc_cmd 0 20k" \ - -c "pwrite 8k 4k" $sync_cmd \ - -c "$zero_cmd 4k 12k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "$alloc_cmd 0 320k" \ + -c "pwrite 128k 64k" $sync_cmd \ + -c "$zero_cmd 64k 192k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -453,20 +453,20 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "$alloc_cmd 0 20k" \ - -c "pwrite 0k 8k" $sync_cmd \ - -c "pwrite 12k 8k" -c "fsync" \ - -c "$zero_cmd 4k 12k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "$alloc_cmd 0 320k" \ + -c "pwrite 0k 128k" $sync_cmd \ + -c "pwrite 192k 128k" -c "fsync" \ + -c "$zero_cmd 64k 192k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile echo " 14. data -> hole @ EOF" rm -f $testfile - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "pwrite 0 20k" $sync_cmd \ - -c "$zero_cmd 12k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "pwrite 0 320k" $sync_cmd \ + -c "$zero_cmd 192k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -475,9 +475,9 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "pwrite 0 20k" $sync_cmd \ - -c "$zero_cmd 0k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "pwrite 0 320k" $sync_cmd \ + -c "$zero_cmd 0k 128k" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now _md5_checksum $testfile
@@ -489,12 +489,12 @@ _test_generic_punch() else cp $testfile $testfile.2 fi - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "pwrite 8k 12k" -c "fsync" $testfile.2 \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "pwrite 128k 192k" -c "fsync" $testfile.2 \ > /dev/null - $XFS_IO_PROG -f -c "truncate 20k" \ - -c "pwrite 0 20k" $sync_cmd \ - -c "$zero_cmd 0k 8k" \ + $XFS_IO_PROG -f -c "truncate 320k" \ + -c "pwrite 0 320k" $sync_cmd \ + -c "$zero_cmd 0k 128k" \ -c "fadvise -d" \ -c "$map_cmd -v" $testfile | $filter_cmd diff $testfile $testfile.2
@@ -506,9 +506,8 @@ _test_generic_punch() if [ "$remove_testfile" ]; then rm -f $testfile fi - block_size=`stat -f $TEST_DEV | grep "Block size" | cut -d " " -f3` - $XFS_IO_PROG -f -c "truncate $block_size" \ - -c "pwrite 0 $block_size" $sync_cmd \ + $XFS_IO_PROG -f -c "truncate 64k" \ + -c "pwrite 0 64k" $sync_cmd \ -c "$zero_cmd 128 128" \ -c "$map_cmd -v" $testfile | $filter_cmd [ $? -ne 0 ] && die_now
tests/generic/255.out +238 -238
545 lines not on this page · raw message
tests/xfs/242.out +59 -59
136 lines not on this page · raw message
tests/xfs/252.out +238 -238
545 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 8 lines · chandan
From
cf6e1fc3a8d7806a97055b5f483cf50f58c8294fMon Sep 17 00:00:00 2001
From: chandan <[email protected]>
Date: Thu, 8 Aug 2013 11:33:10 +0530
Subject: [PATCH]_test_generic_punch: Extend $testfile's size to work with 64k
block.The current script does not work with 64k block size. This patch fixes it by creating a larger $testfile.
I can see why we might want to support such a configuration, but the changes being made defeat the purpose of the sizes chosen for this test.
That is, most people testing are using 4k block size filesystems, and the sizes are selected such that single blocks are being manipulated by the test. it's looking for corner/edge case problems, and changing the code to now use chunks of 64k changes all the edge cases being tested.
Indeed, even the new bmap output is likely to cause problems in that small block size filesystems are no guaranteed to allocate contiguous blocks linearly. This is another reason that 4k was chosen as the size of the regions.
So, to do this properly, I'd suggest that the code needs to scale the offset/size of the IO being done by the filesystem block size, not use a fixed size. Using a filter on the bmap output to handle the different block ranges will ensure everything works correctly from a golden output POV, except for one thing - the md5sum.
The md5sum of the file is used for integrity checking and will change as the block size changes. I haven't thought about a way to avoid his problem yet but we do need some form of integrity check to ensure all filesystems are ending up with the correct contents in the files.
In the interim, if all you want to do is stop a test failure on your power machines, then either add a "_requires_le_4k_blocksize" check to avoid running the test on problematic filesystems or specifically create the fileystem being tested with a 4k block size...
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Hello Dave,
Quoted 6 lines
So, to do this properly, I'd suggest that the code needs to scale the offset/size of the IO being done by the filesystem block size, not use a fixed size. Using a filter on the bmap output to handle the different block ranges will ensure everything works correctly from a golden output POV, except for one thing - the md5sum.
Yes, we did try the approach of using variable block size and scaling the offset values in the filter function. But we got stuck working with md5sum (since we would need two sets of md5sums (with and without '-k' option) per block size). As suggested, I will be reposting the patch to use "_requires_le_4k_blocksize".
chandan