[PATCH 2/3] xfsqa: fix size specification for scratch mkfs

Eric Sandeen sandeen at sandeen.net
Wed Mar 3 10:21:06 CST 2010


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?


How about making _scratch_mkfs_sized something like:

_scratch_mkfs_sized()
{
    fssize=`echo $1 | bc`
    ...


as a quick test this seems to work:

#!/bin/bash

my_function()
{
	SIZE=$1
	echo $SIZE
	SIZE2=`echo $SIZE | bc`
	echo $SIZE2
}

SIZE=24*1024*1024
my_function $SIZE
SIZE=2410241024
my_function $SIZE

yields the right answers for both numbers & expressions passed in:

#./testit.sh 
24*1024*1024
25165824
2410241024
2410241024

 




More information about the xfs mailing list