linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org,
	darrick.wong@oracle.com
Subject: Re: [PATCH v2 2/4] punch: Implement fixup for fiemap range queries
Date: Tue, 7 Nov 2017 13:18:55 +0800	[thread overview]
Message-ID: <20171107051855.GJ17339@eguan.usersys.redhat.com> (raw)
In-Reply-To: <1509459096-7585-2-git-send-email-nborisov@suse.com>

On Tue, Oct 31, 2017 at 04:11:34PM +0200, Nikolay Borisov wrote:
> With the new  range query support for the fiemap command,
> the command also started printing hole extent for files which
> consist of only a hole. This change breaks tests which are
> executed with a version of xfs_io that doesn't support fiemap's
> range query.
> 
> Fix this by implementing a function which will fixup the output
> of tests which are broken by emulating the output on older
> xfs_io versions
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com> 
> ---
>  common/punch | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/common/punch b/common/punch
> index c4ed261..b20dc30 100644
> --- a/common/punch
> +++ b/common/punch
> @@ -218,6 +218,23 @@ _filter_fiemap()
>  	_coalesce_extents
>  }
>  
> +_fiemap_range_fixup()

Good to have some comments too on what this function does.

> +{
> +	#check if we support ranged query
> +	$XFS_IO_PROG -c "help fiemap" | head -n 1 | grep -q "[offset [len]]"

return immediately if fiemap supports range query?

Thanks,
Eryu

> +	local range_sup=$?
> +	#check if the file consists of a single hole only
> +	echo "$1" | grep -q "^0\: \[.*\]\: hole$"
> +	local sole_hole=$?
> +	local filesize="$(((`stat -c %s $1` / 512) - 1))"
> +	local output_line_num=`$XFS_IO_PROG -c 'fiemap' $testfile | wc -l`
> +
> +	if [ $range_sup -eq 1 ] && [ $sole_hole -eq 1  ] && [ $output_line_num -eq 1 ]
> +	then
> +		echo "0: [0..$filesize]: hole"
> +	fi
> +}
> +
>  _filter_fiemap_flags()
>  {
>  	$AWK_PROG '
> @@ -363,6 +380,7 @@ _test_generic_punch()
>  	$XFS_IO_PROG -f -c "truncate $_20k" \
>  		-c "$zero_cmd $_4k $_8k" \
>  		-c "$map_cmd -v" $testfile | $filter_cmd
> +	_fiemap_range_fixup $testfile
>  	[ $? -ne 0 ] && die_now
>  	_md5_checksum $testfile
>  
> @@ -470,6 +488,7 @@ _test_generic_punch()
>  		-c "pwrite $_8k $_4k" $sync_cmd \
>  		-c "$zero_cmd $_4k $_12k" \
>  		-c "$map_cmd -v" $testfile | $filter_cmd
> +	_fiemap_range_fixup $testfile
>  	[ $? -ne 0 ] && die_now
>  	_md5_checksum $testfile
>  
> -- 
> 2.7.4
> 

  reply	other threads:[~2017-11-07  5:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-27 12:37 [PATCH v2 0/2] Fiemap's range query Nikolay Borisov
2017-10-27 12:37 ` [PATCH 1/2] fiemap: Factor out actual fiemap call code Nikolay Borisov
2017-10-27 16:33   ` Darrick J. Wong
2017-10-27 16:37     ` Darrick J. Wong
2017-10-27 12:37 ` [PATCH 1/2] initial fiemap test Nikolay Borisov
2017-10-27 12:44   ` Eryu Guan
2017-10-31  9:22     ` Nikolay Borisov
2017-10-31  9:32       ` Eryu Guan
2017-10-31 12:27         ` Nikolay Borisov
2017-10-27 12:37 ` [PATCH 2/2] fiemap: Implement ranged query Nikolay Borisov
2017-10-27 12:37 ` [PATCH 2/2] generic: Adjust generic test ouputs for new fiemap implementation Nikolay Borisov
2017-10-27 12:46   ` Eryu Guan
2017-10-27 12:48     ` Nikolay Borisov
2017-10-31 14:10 ` [PATCH v2 1/2] fiemap: Factor out actual fiemap call code Nikolay Borisov
2017-10-31 14:10   ` [PATCH v2 2/2] fiemap: Implement ranged query Nikolay Borisov
2017-10-31 14:11   ` [PATCH v2 1/4] common: Check for fiemap range argument support Nikolay Borisov
2017-10-31 14:11     ` [PATCH v2 2/4] punch: Implement fixup for fiemap range queries Nikolay Borisov
2017-11-07  5:18       ` Eryu Guan [this message]
2017-10-31 14:11     ` [PATCH v2 3/4] generic: Adjust generic test ouputs for new fiemap implementation Nikolay Borisov
2017-11-07  5:15       ` Eryu Guan
2017-10-31 14:11     ` [PATCH v2 4/4] xfs: initial fiemap range query test Nikolay Borisov
2017-11-02  3:16     ` [PATCH v2 1/4] common: Check for fiemap range argument support Eryu Guan
2017-11-02  6:59       ` Nikolay Borisov
2017-11-02  8:13       ` [PATCH v3] " Nikolay Borisov
2017-11-02 21:12         ` Dave Chinner
2017-11-03 14:05           ` Nikolay Borisov
2017-11-03 16:28             ` Darrick J. Wong
2017-11-14 15:09         ` Eric Sandeen
2017-11-15  7:41           ` Eryu Guan
2017-10-31 20:29   ` [PATCH v2 1/2] fiemap: Factor out actual fiemap call code Darrick J. Wong
2017-10-31 20:32     ` Nikolay Borisov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171107051855.GJ17339@eguan.usersys.redhat.com \
    --to=eguan@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).