Skip to contentSkip to conversation

xfstests: use correct size value in generic/273

PATCH Superseded Brian Foster 3 participants 4 messages Nov 20, 2013 – Nov 21, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: use correct size value in generic/273

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.

---
 tests/generic/273 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/generic/273 +1 -1
index 63bbf9b..2d54493 100755
@@ -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
Signature · 6 lines
1.8.1.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 21 lines · Brian Foster

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.

---
 tests/generic/273 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/generic/273 +0 -0
index 63bbf9b..2d54493 100755

tests/generic/273 _file_create() · line 74

Quoted 8 lines
tests/generic/273 +1 -1
@@ -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.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw
Quoted 33 lines · Dave Chinner
Quoted 21 lines · Brian Foster

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.

---
 tests/generic/273 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/generic/273 +0 -0
index 63bbf9b..2d54493 100755

tests/generic/273 _file_create() · line 74

Quoted 8 lines
tests/generic/273 +1 -1
@@ -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?

Quoted 5 lines
$ 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:

I sure didn't. Not in my manpage or in my df --help output... Is it new?

$ df --block-size=1 --output=avail /
df: unrecognized option '--output=avail'
Try `df --help' for more information.

The above chicken-scratching went in w/ 1fce0780f63ccdd308767e23fe39a18d30d973d6 because:

273: fix of reading scratch size and removing lost+found

There were two reasons why test 273 was failing. Firstrly, when running on ext4 fs it was removing everything from SCRATCH_MNT directory at the beginning of tests including the lost+found directory. This caused error while checking scratch fs after finishing test. Secondly, obtaining of the partition size was not counting with with behaviour of df utility which may split the line containg informations about one partition when it is too long thus it may have returned nothing.

First problem was solved with removing all unnecessary rm -rf commands and the second one was fixed with alternative awk script which is able to deal with any line splitting possible. Also 'umount $SCRATCH_DEV' was substituted for '_scratch_unmount'.

presumably from long lvm devicenames.

# df --block-size=1 /dev/mapper/vg_bp05-lv_home
Filesystem           1B-blocks      Used Available Use% Mounted on
/dev/mapper/vg_bp05-lv_home
                     437264879616 254143942656 183120936960  59% /home
Quoted 4 lines
$ df --block-size=1 --output=avail $SCRATCH_DEV | tail -1
5282562048
$
Quoted 8 lines

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?

yeah, and I guess it does work:

# df -T -P --block-size=1 /dev/mapper/vg_bp05-lv_home | tail -1 | awk '// { print $5 }'
183120936960

-Eric

Quoted 4 lines

Cheers,

Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 34 lines · Eric Sandeen
Quoted 33 lines · Dave Chinner
Quoted 21 lines · Brian Foster

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.

---
 tests/generic/273 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/generic/273 +0 -0
index 63bbf9b..2d54493 100755

tests/generic/273 _file_create() · line 74

Quoted 8 lines
tests/generic/273 +1 -1
@@ -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?

Quoted 7 lines
Quoted 5 lines
$ 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:

I sure didn't. Not in my manpage or in my df --help output... Is it new?

It must be - I noticed it a while back when I upgraded a 5 year old coreutils package to 8.21, so it's sometime in the past 5 years it was added ;)

Quoted 6 lines

presumably from long lvm devicenames.

# df --block-size=1 /dev/mapper/vg_bp05-lv_home
Filesystem           1B-blocks      Used Available Use% Mounted on
/dev/mapper/vg_bp05-lv_home
                     437264879616 254143942656 183120936960  59% /home

The "-P" option prevents that from occurring - from the info page:

`-P'
`--portability'
Use the POSIX output format. This is like the default format except for the following:

1. The information about each file system is always printed on exactly one line; a mount device is never put on a line by itself. This means that if the mount device name is more than 20 characters long (e.g., for some network mounts), the columns are misaligned.

So that's no longer an issue when we use $DF_PROG....

Quoted 10 lines
Quoted 5 lines
$ df -T -P --block-size=1 $SCRATCH_DEV | tail -1 | awk '// { print $5 }'
5282562048
$

Looks a little easier to understand, yes?

yeah, and I guess it does work:

# df -T -P --block-size=1 /dev/mapper/vg_bp05-lv_home | tail -1 | awk '// { print $5 }'
183120936960

Great!

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs