xfstests: minor fixes for the reflink/dedupe tests
cover xfstests: minor fixes for the reflink/dedupe tests
This is a patch set against the reflink/dedupe test cases in xfstests. All three patches fix some minor problems in the giant testcase merge last weekend.
The zeroth patch ought to be Filipe Manana's patch ("fstests:
generic/158, test dedupe with destination offset past EOF") but as he just resent that this morning, I won't repost it here.
The first patch, then, corrects the error output in the high offset dedupe test (generic/304).
The second patch changes punch-alternating.c to use the filesystem accounting block size to determine where to punch holes in the file because that value is the internal filesystem block size. This makes the program behave as expected when testing with non-page-size block sizes on XFS.
The third patch adds to _require_xfs_io_command the ability to check that a subcommand supports a particular command line argument and adds to xfs/24[356] the ability to check for the -c switch to the xfs_io bmap command.
Comments and questions are, as always, welcome. The fixes are available on github[1].
--D
PATCH 1/3 generic/304: fix high offset
"Invalid argument" is a better response to an impossibly high offset dedupe request than "extents don't match", so change the test.
--- tests/generic/304.out | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/generic/304.out +1 -1
@@ -8,7 +8,7 @@ dedupe: Invalid argument Dedupe past maximum file size in dest file (should fail) dedupe: Invalid argument Dedupe high offset to low offset -dedupe: Extents did not match. +dedupe: Invalid argument Dedupe past source file EOF (should fail) dedupe: Invalid argument Dedupe max size at nonzero offset (should fail)
Re: [PATCH 1/3] generic/304: fix high offset
Quoted 2 lines · Darrick J. Wong
"Invalid argument" is a better response to an impossibly high offset dedupe request than "extents don't match", so change the test.
What does btrfs return here?
Re: [PATCH 1/3] generic/304: fix high offset
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Darrick J. Wong
"Invalid argument" is a better response to an impossibly high offset dedupe request than "extents don't match", so change the test.
What does btrfs return here?
-EINVAL, so this makes the test pass on btrfs.
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
Filipe David Manana, "Reasonable men adapt themselves to the world. Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men."
Christoph Hellwig
Reviewed-byRe: [PATCH 1/3] generic/304: fix high offset
Quoted 3 lines · Filipe Manana
Quoted 1 line
What does btrfs return here?
-EINVAL, so this makes the test pass on btrfs.
Ok, looks fine to me then:
PATCH 2/3 punch-alternating: use the block size reported by the fs for punching
In reply to Darrick J. WongWhen we're trying to punch alternating blocks out of a file, use the bsize reported by fstatfs so that we can punch out single blocks.
--- src/punch-alternating.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
src/punch-alternating.c +6 -1
@@ -14,6 +14,7 @@int main (int argc,char *argv[]) {struct stat s; +struct statfs sf;off_t offset;int fd;blksize_t blksz;
@@ -35,8 +36,12 @@ int main(int argc, char *argv[])if (error) goto err; + error =fstatfs (fd, &sf); +if (error) + goto err; + sz = s.st_size; - blksz = s.st_blksize; + blksz = sf.f_bsize; mode =FALLOC_FL_PUNCH_HOLE |FALLOC_FL_KEEP_SIZE ;for (offset =0 ; offset < sz; offset += blksz *2 ) {
Re: [PATCH 2/3] punch-alternating: use the block size reported by the fs for punching
Looks fine,
PATCH 3/3 xfs/24[356]: check for -c switch to xfs_io bmap command
In reply to Darrick J. WongExtend _require_xfs_io_command so that we can pass it a command line argument to look for, and then use new capabililty in the relevant tests to ensure that bmap knows how to dump CoW fork contents (bmap -c)
--- common/rc | 9 +++++++-- tests/xfs/243 | 1 + tests/xfs/245 | 1 + tests/xfs/246 | 1 + 4 files changed, 10 insertions(+), 2 deletions(-)
common/rc +7 -2
@@ -1831,12 +1831,13 @@ _user_do() _require_xfs_io_command() { - if [ $# -ne 1 ] + if [ -z "$1" ] then - echo "Usage: _require_xfs_io_command command" 1>&2 + echo "Usage: _require_xfs_io_command command [switch]" 1>&2 exit 1 fi command=$1 + param=$2 testfile=$TEST_DIR/$$.xfs_io case $command in
@@ -1866,6 +1867,10 @@ _require_xfs_io_command() _notrun "xfs_io $command support is missing" echo $testio | grep -q "Operation not supported" && \ _notrun "xfs_io $command failed (old kernel/wrong fs?)" + + test -z "$param" && return + $XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \ + _notrun "xfs_io $command doesn't support $param" } # check that xfs_db supports a specific command
tests/xfs/243 +1 -0
@@ -56,6 +56,7 @@ _supported_fs xfs _require_scratch_reflink _require_xfs_io_command "falloc" _require_xfs_io_command "fpunch" +_require_xfs_io_command "bmap" "-c" _require_cp_reflink rm -f $seqres.full
tests/xfs/245 +1 -0
@@ -49,6 +49,7 @@ _supported_os Linux _supported_fs xfs _require_scratch_reflink _require_xfs_io_command "falloc" +_require_xfs_io_command "bmap" "-c" _require_cp_reflink rm -f $seqres.full
tests/xfs/246 +1 -0
@@ -42,6 +42,7 @@ _cleanup() # real QA test starts here _supported_os Linux _supported_fs xfs +_require_xfs_io_command "bmap" "-c" rm -f $seqres.full
Re: [PATCH 3/3] xfs/24[356]: check for -c switch to xfs_io bmap command
Looks fine,