From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfstests: use correct size value in generic/273
Date: Thu, 21 Nov 2013 13:46:05 +1100 [thread overview]
Message-ID: <20131121024605.GB6188@dastard> (raw)
In-Reply-To: <1384970070-58732-1-git-send-email-bfoster@redhat.com>
On Wed, Nov 20, 2013 at 12:54:30PM -0500, Brian Foster wrote:
> generic/273 factors the "space available" output from df into the
> calculation for the size of the origin data set. Recent commit
>
> bfdd1e72b358 xfstests: added -P option to $DF_PROG
>
> ... converted the use of 'df' to $DF_PROG. This implicitly adds the
> -T parameter to add the fs type column, shifts the available space
> column over by one and unintentionally causes 273 to look at "used
> space" and create too small of a data set for a useful test.
> Realign to the to the available space value.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
> tests/generic/273 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/generic/273 b/tests/generic/273
> index 63bbf9b..2d54493 100755
> --- a/tests/generic/273
> +++ b/tests/generic/273
> @@ -68,7 +68,7 @@ _file_create()
>
> cd $SCRATCH_MNT/origin
>
> - _disksize=`$DF_PROG --block-size=1 $SCRATCH_DEV | awk -v sd=$SCRATCH_DEV 'BEGIN{c=0}{for(i=1;i<=NF;++i){a[c]=$i;++c}}END{for(entry in a){if(a[entry] ~ sd){print a[entry + 3]; break}}}'`
> + _disksize=`$DF_PROG --block-size=1 $SCRATCH_DEV | awk -v sd=$SCRATCH_DEV 'BEGIN{c=0}{for(i=1;i<=NF;++i){a[c]=$i;++c}}END{for(entry in a){if(a[entry] ~ sd){print a[entry + 4]; break}}}'`
> _disksize=$(($_disksize / 3))
> _num=$(($_disksize / $count / $threads / 4096))
> _count=$count
Just what is this bunch of unmaintainable line noise actually doing?
$ df -T -P --block-size=1 $SCRATCH_DEV | awk -v sd=$SCRATCH_DEV 'BEGIN{c=0}{for(i=1;i<=NF;++i){a[c]=$i;++c}}END{for(entry in a){if(a[entry] ~ sd){print a[entry + 4]; break}}}'
5282562048
$
Ok, someone didn't know about --output:
$ df --block-size=1 --output=avail $SCRATCH_DEV | tail -1
5282562048
$
But --output is incompatible with DF_PROG="df -T -P" and so we need
to do:
$ df -T -P --block-size=1 $SCRATCH_DEV | tail -1 | awk '// { print $5 }'
5282562048
$
Looks a little easier to understand, yes?
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-11-21 2:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 17:54 [PATCH] xfstests: use correct size value in generic/273 Brian Foster
2013-11-21 2:46 ` Dave Chinner [this message]
2013-11-21 2:59 ` Eric Sandeen
2013-11-21 3:21 ` Dave Chinner
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=20131121024605.GB6188@dastard \
--to=david@fromorbit.com \
--cc=bfoster@redhat.com \
--cc=xfs@oss.sgi.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