On Wed, Mar 03, 2010 at 07:58:09AM -0500, Christoph Hellwig wrote:
> On Wed, Mar 03, 2010 at 05:19:21PM +1100, Dave Chinner wrote:
> > When making a specifically sized scratch filesystem, we need to
> > calculate the size rather than assigning the caclculation expression
> > to a variable and passing that into the _scratch_mkfs_sized
> > function. Currently sized filesystems are failing to be made and the
> > code is falling back to full sized filesystems so we are not testing
> > enospc issues correctly.
>
> This seems rather fragile. Maybe instead of calculating the bignums
> which I suspect are the problem could we pass symbolic values like 104M
> in and parse them in _scratch_mkfs_sized?
The problem was that "mkfs.xfs -d size=104*1024*1024 ..." fails
because $fssize was not a numeric value.
There's no problem with 64 bit numbers with expr:
$ expr 5 \* 1024 \* 1024 \* 1024 \* 1024
5497558138880
So specifying large sizes by a byte count like this is not an
issue. Lots of other tests use expr in this way.
If we change the calculations in _scratch_mkfs_sized() to use expr
then there's no 32 bit overflow issues, either. This seems like a
simpler way to go to introduce the complexity of symbolic values
and parsing, esp. as we'd still have to handle 64 bit values
correctly...
The updated patch below uses expr in _scratch_mkfs_sized as well.
Cheers,
Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx
xfsqa: fix size specification for scratch mkfs
When making a specifically sized scratch filesystem, we need to
calculate the size rather than assigning the caclculation expression
to a variable and passing that into the _scratch_mkfs_sized
function. Currently sized filesystems are failing to be made and the
code is falling back to full sized filesystems so we are not testing
enospc issues correctly.
Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx>
---
077 | 2 +-
204 | 2 +-
common.rc | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/077 b/077
index 72f1b2a..4e12163 100755
--- a/077
+++ b/077
@@ -62,7 +62,7 @@ rm -f $seq.full
umount $SCRATCH_DEV >/dev/null 2>&1
echo "*** MKFS ***" >>$seq.full
echo "" >>$seq.full
-let SIZE=50*1024*1024
+SIZE=`expr 50 \* 1024 \* 1024`
_scratch_mkfs_sized $SIZE >>$seq.full 2>&1 \
|| _fail "mkfs failed"
_scratch_mount >>$seq.full 2>&1 \
diff --git a/204 b/204
index 14ebcdc..8b94f60 100755
--- a/204
+++ b/204
@@ -40,7 +40,7 @@ _supported_os Linux
_require_scratch
-SIZE=104*1024*1024
+SIZE=`expr 104 \* 1024 \* 1024`
_scratch_mkfs_sized $SIZE &> /dev/null
_scratch_mount
diff --git a/common.rc b/common.rc
index ca2cd2c..d71e0a2 100644
--- a/common.rc
+++ b/common.rc
@@ -320,7 +320,7 @@ _scratch_mkfs_sized()
fssize=$1
blocksize=$2
[ -z "$blocksize" ] && blocksize=4096
- let blocks=$fssize/$blocksize
+ blocks=`expr $fssize / $blocksize`
case $FSTYP in
xfs)
|