linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Nikolay Borisov <nborisov@suse.com>,
	linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH v3] common: Check for fiemap range argument support
Date: Wed, 15 Nov 2017 15:41:33 +0800	[thread overview]
Message-ID: <20171115074133.GN17339@eguan.usersys.redhat.com> (raw)
In-Reply-To: <cb9fba60-a000-d08a-5099-3aa604724568@sandeen.net>

On Tue, Nov 14, 2017 at 09:09:21AM -0600, Eric Sandeen wrote:
> 
> 
> On 11/2/17 3:13 AM, Nikolay Borisov wrote:
> > From: Nikolay Borsiov <nborisov@suse.com>
> > 
> > Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> > ---
> > v3:
> >  * Changed the way we detect ranged args. Now use a regexp which checks 
> >  explicitly for the ranged args
> >  common/rc | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/common/rc b/common/rc
> > index e2a8229..f7a5fe9 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -2053,8 +2053,15 @@ _require_xfs_io_command()
> >  			-c "$command 4k 8k" $testfile 2>&1`
> >  		;;
> >  	"fiemap")
> > +		if echo "$param" | egrep -q "[[:digit:]]+[bskmgtpe]? [[:digit:]]+[bskmgtpe]?$"
> > +		then
> > +			$XFS_IO_PROG -c "help fiemap" | head -n 1 | grep -q "[offset [len]]" || \
> > +				_notrun "xfs_io $command range param support is missing"
> > +		fi
> > +
> 
> What if, rather than difficult to read regexps, we actually checked the functionality?
> The check already writes a testfile; you could try fiemapping past EOF and see what
> you get, i.e. for a file in a single 4k block:
> 
> $ io/xfs_io -c "fiemap" short
> short:
> 	0: [0..7]: 2788960..2788967
> 
> Mapping past EOF will give you no extents (if the range values are honored by the
> command):
> 
> $ io/xfs_io -c "fiemap 4k 4k" short
> short:

Yeah, I'm OK with it, looks better than the complicated regexp and could
keep the fiemap command interface simpler.

> 
> >  		testio=`$XFS_IO_PROG -F -f -c "pwrite 0 20k" -c "fsync" \
> >  			-c "fiemap -v $param" $testfile 2>&1`
> 
> so I think you could switch based on [ -n $param ] about whether we were asked
> to check a range and if so, map past EOF, and return success or fail based
> on what you get back.  The only slight weirdness is that you're asking to check
> a specific range (_require_xfs_io_command "fiemap" "0 4k") but possibly testing
> a different one ("20k 4k") but not sure if that matters.
> 
> It'd be a bit of a departure but with enough comments, maybe ok to do it as:
> 
> _require_xfs_io_command "fiemap" "ranged"
> 
> and use the "ranged" param to DTRT in the test.

This looks fine too to me.

Thanks,
Eryu

> 
> -Eric
> 
> > +
> >  		param_checked=1
> >  		;;
> >  	"flink" )
> > 

  reply	other threads:[~2017-11-15  7:41 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
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 [this message]
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=20171115074133.GN17339@eguan.usersys.redhat.com \
    --to=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=sandeen@sandeen.net \
    /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).