xfs
[Top] [All Lists]

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

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 2/3] xfsqa: fix size specification for scratch mkfs
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Wed, 03 Mar 2010 10:21:06 -0600
Cc: Dave Chinner <david@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <20100303125809.GB26672@xxxxxxxxxxxxx>
References: <1267597162-12092-1-git-send-email-david@xxxxxxxxxxxxx> <1267597162-12092-3-git-send-email-david@xxxxxxxxxxxxx> <20100303125809.GB26672@xxxxxxxxxxxxx>
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
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

 

<Prev in Thread] Current Thread [Next in Thread>