[v4,2/3] common: Implement fiemap's range query check
diff mbox

Message ID 1510747900-13440-2-git-send-email-nborisov@suse.com
State New
Headers show

Commit Message

Nikolay Borisov Nov. 15, 2017, 12:11 p.m. UTC
Allow for users of xfstest to assert the presence of fiemap's
range query capabilities by requesting the "ranged" parameter.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 common/rc | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Eryu Guan Nov. 21, 2017, 5:39 a.m. UTC | #1
On Wed, Nov 15, 2017 at 02:11:39PM +0200, Nikolay Borisov wrote:
> Allow for users of xfstest to assert the presence of fiemap's
> range query capabilities by requesting the "ranged" parameter.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

I think this patch could be folded into patch 3, the change comes with
users of the change.

> ---
>  common/rc | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index e2a8229..c98c224 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -2053,6 +2053,12 @@ _require_xfs_io_command()
>  			-c "$command 4k 8k" $testfile 2>&1`
>  		;;
>  	"fiemap")
> +		if echo "$param" | grep -q "ranged"; then

Please add comments on the special "ranged" param.

> +			param=$(echo "$param" | sed "s/ranged//")
> +			$XFS_IO_PROG -F -f -c "pwrite 0 5k" -c "fsync" $testfile > /dev/null 2>&1
> +			lines=$($XFS_IO_PROG -c "fiemap 6k" $testfile 2>&1 | wc -l)
> +			[ $lines -eq 1 ] || _notrun "xfs_io $command ranged support is missing"

I don't see why we're expecting $lines to be 1, maybe I was testing
Eric's version of ranged query patch, I always see file name followed by
a extent description, so that's two lines. e.g.

testfile:
        0: [8..15]: 1300882584..1300882591

But how about just checking for "[offset [len]]" string in help message?
Because we know the test is asking for fiemap ranged support at this
point due to the special "ranged" param.

Thanks,
Eryu

> +		fi
>  		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
>  			-c "fiemap -v $param" $testfile 2>&1`
>  		param_checked=1
> -- 
> 2.7.4
> 
--
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

Patch
diff mbox

diff --git a/common/rc b/common/rc
index e2a8229..c98c224 100644
--- a/common/rc
+++ b/common/rc
@@ -2053,6 +2053,12 @@  _require_xfs_io_command()
 			-c "$command 4k 8k" $testfile 2>&1`
 		;;
 	"fiemap")
+		if echo "$param" | grep -q "ranged"; then
+			param=$(echo "$param" | sed "s/ranged//")
+			$XFS_IO_PROG -F -f -c "pwrite 0 5k" -c "fsync" $testfile > /dev/null 2>&1
+			lines=$($XFS_IO_PROG -c "fiemap 6k" $testfile 2>&1 | wc -l)
+			[ $lines -eq 1 ] || _notrun "xfs_io $command ranged support is missing"
+		fi
 		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
 			-c "fiemap -v $param" $testfile 2>&1`
 		param_checked=1