linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4.3 0/3] xfstests: minor fixes for the reflink/dedupe tests
@ 2016-02-15 20:46 Darrick J. Wong
  2016-02-15 20:46 ` [PATCH 1/3] generic/304: fix high offset Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Darrick J. Wong @ 2016-02-15 20:46 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

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

[1] https://github.com/djwong/xfstests/tree/for-dave

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] generic/304: fix high offset
  2016-02-15 20:46 [PATCH v4.3 0/3] xfstests: minor fixes for the reflink/dedupe tests Darrick J. Wong
@ 2016-02-15 20:46 ` Darrick J. Wong
  2016-02-17  9:56   ` Christoph Hellwig
  2016-02-15 20:46 ` [PATCH 2/3] punch-alternating: use the block size reported by the fs for punching Darrick J. Wong
  2016-02-15 20:46 ` [PATCH 3/3] xfs/24[356]: check for -c switch to xfs_io bmap command Darrick J. Wong
  2 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2016-02-15 20:46 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

"Invalid argument" is a better response to an impossibly high offset
dedupe request than "extents don't match", so change the test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/generic/304.out |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/tests/generic/304.out b/tests/generic/304.out
index 4af2a39..7b5ff0e 100644
--- a/tests/generic/304.out
+++ b/tests/generic/304.out
@@ -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)


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] punch-alternating: use the block size reported by the fs for punching
  2016-02-15 20:46 [PATCH v4.3 0/3] xfstests: minor fixes for the reflink/dedupe tests Darrick J. Wong
  2016-02-15 20:46 ` [PATCH 1/3] generic/304: fix high offset Darrick J. Wong
@ 2016-02-15 20:46 ` Darrick J. Wong
  2016-02-17  9:57   ` Christoph Hellwig
  2016-02-15 20:46 ` [PATCH 3/3] xfs/24[356]: check for -c switch to xfs_io bmap command Darrick J. Wong
  2 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2016-02-15 20:46 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

When 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.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 src/punch-alternating.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)


diff --git a/src/punch-alternating.c b/src/punch-alternating.c
index 9566310..4148622 100644
--- a/src/punch-alternating.c
+++ b/src/punch-alternating.c
@@ -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) {


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] xfs/24[356]: check for -c switch to xfs_io bmap command
  2016-02-15 20:46 [PATCH v4.3 0/3] xfstests: minor fixes for the reflink/dedupe tests Darrick J. Wong
  2016-02-15 20:46 ` [PATCH 1/3] generic/304: fix high offset Darrick J. Wong
  2016-02-15 20:46 ` [PATCH 2/3] punch-alternating: use the block size reported by the fs for punching Darrick J. Wong
@ 2016-02-15 20:46 ` Darrick J. Wong
  2016-02-17  9:58   ` Christoph Hellwig
  2 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2016-02-15 20:46 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-btrfs, fstests, xfs

Extend _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)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc     |    9 +++++++--
 tests/xfs/243 |    1 +
 tests/xfs/245 |    1 +
 tests/xfs/246 |    1 +
 4 files changed, 10 insertions(+), 2 deletions(-)


diff --git a/common/rc b/common/rc
index b11f170..e810062 100644
--- a/common/rc
+++ b/common/rc
@@ -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
diff --git a/tests/xfs/243 b/tests/xfs/243
index 629173e..d75cfd8 100755
--- a/tests/xfs/243
+++ b/tests/xfs/243
@@ -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
diff --git a/tests/xfs/245 b/tests/xfs/245
index 6da701d..7f80260 100755
--- a/tests/xfs/245
+++ b/tests/xfs/245
@@ -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
diff --git a/tests/xfs/246 b/tests/xfs/246
index 13b0c98..bf471cc 100755
--- a/tests/xfs/246
+++ b/tests/xfs/246
@@ -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
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] generic/304: fix high offset
  2016-02-15 20:46 ` [PATCH 1/3] generic/304: fix high offset Darrick J. Wong
@ 2016-02-17  9:56   ` Christoph Hellwig
  2016-02-17 10:04     ` Filipe Manana
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2016-02-17  9:56 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-btrfs, fstests, xfs

On Mon, Feb 15, 2016 at 12:46:14PM -0800, Darrick J. Wong wrote:
> "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?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] punch-alternating: use the block size reported by the fs for punching
  2016-02-15 20:46 ` [PATCH 2/3] punch-alternating: use the block size reported by the fs for punching Darrick J. Wong
@ 2016-02-17  9:57   ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2016-02-17  9:57 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-btrfs, fstests, xfs

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] xfs/24[356]: check for -c switch to xfs_io bmap command
  2016-02-15 20:46 ` [PATCH 3/3] xfs/24[356]: check for -c switch to xfs_io bmap command Darrick J. Wong
@ 2016-02-17  9:58   ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2016-02-17  9:58 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-btrfs, fstests, xfs

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] generic/304: fix high offset
  2016-02-17  9:56   ` Christoph Hellwig
@ 2016-02-17 10:04     ` Filipe Manana
  2016-02-17 10:10       ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Filipe Manana @ 2016-02-17 10:04 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Darrick J. Wong, Dave Chinner, linux-btrfs@vger.kernel.org,
	fstests, xfs@oss.sgi.com

On Wed, Feb 17, 2016 at 9:56 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Mon, Feb 15, 2016 at 12:46:14PM -0800, Darrick J. Wong wrote:
>> "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.

> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
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."

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] generic/304: fix high offset
  2016-02-17 10:04     ` Filipe Manana
@ 2016-02-17 10:10       ` Christoph Hellwig
  0 siblings, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2016-02-17 10:10 UTC (permalink / raw)
  To: Filipe Manana
  Cc: Christoph Hellwig, Darrick J. Wong, Dave Chinner,
	linux-btrfs@vger.kernel.org, fstests, xfs@oss.sgi.com

On Wed, Feb 17, 2016 at 10:04:23AM +0000, Filipe Manana wrote:
> > What does btrfs return here?
> 
> -EINVAL, so this makes the test pass on btrfs.

Ok, looks fine to me then:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-02-17 10:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-15 20:46 [PATCH v4.3 0/3] xfstests: minor fixes for the reflink/dedupe tests Darrick J. Wong
2016-02-15 20:46 ` [PATCH 1/3] generic/304: fix high offset Darrick J. Wong
2016-02-17  9:56   ` Christoph Hellwig
2016-02-17 10:04     ` Filipe Manana
2016-02-17 10:10       ` Christoph Hellwig
2016-02-15 20:46 ` [PATCH 2/3] punch-alternating: use the block size reported by the fs for punching Darrick J. Wong
2016-02-17  9:57   ` Christoph Hellwig
2016-02-15 20:46 ` [PATCH 3/3] xfs/24[356]: check for -c switch to xfs_io bmap command Darrick J. Wong
2016-02-17  9:58   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).