xfs
[Top] [All Lists]

Re: mkfs.xfs doesn't detect size of storage correctly

To: Chris Wedgwood <cw@xxxxxxxx>
Subject: Re: mkfs.xfs doesn't detect size of storage correctly
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 29 Jan 2008 15:21:00 -0600
Cc: Matthias Schniedermeyer <ms@xxxxxxx>, xfs@xxxxxxxxxxx, Barry Naujok <bnaujok@xxxxxxx>
In-reply-to: <20080129203731.GA29094@xxxxxxxxxxxxxxxxxx>
References: <20080129093201.GA16203@xxxxxxx> <20080129171658.GB21228@xxxxxxx> <479F893A.1030402@xxxxxxxxxxx> <20080129203731.GA29094@xxxxxxxxxxxxxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Thunderbird 2.0.0.9 (Macintosh/20071031)
Chris Wedgwood wrote:
> On Tue, Jan 29, 2008 at 02:14:50PM -0600, Eric Sandeen wrote:
>
>   
>> [root@magnesium tmp]# mkfs.xfs -dfile,name=xfsfile,size=750156369920
>>     
>
> I see this too except I'm pre-creating a file of the right length:
>
> -rw-r--r-- 1 root root 750156369920 Jan 29 12:35 xfsfile
>
> [...]
>
> /root/xfsfile  xfs    524G  4.2M  524G   1% /mnt/tmp
>
>   
I think this fixes it, but it was just a quickie so pls double check :)

if agcount * agsize <= dblocks, then the last ag shouldn't be "small"

-Eric

Index: xfsprogs-2.9.5/mkfs/xfs_mkfs.c
===================================================================
--- xfsprogs-2.9.5.orig/mkfs/xfs_mkfs.c
+++ xfsprogs-2.9.5/mkfs/xfs_mkfs.c
@@ -523,7 +523,8 @@ validate_ag_geometry(
         * If the last AG is too small, reduce the filesystem size
         * and drop the blocks.
         */
-       if ( dblocks % agsize != 0 &&
+       if ( agcount * agsize > dblocks &&
+            dblocks % agsize != 0 &&
             (dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog))) {
                fprintf(stderr,
        _("last AG size %lld blocks too small, minimum size is %lld blocks\n"),
@@ -1808,7 +1809,8 @@ _("size %s specified for log subvolume i
         * If the last AG is too small, reduce the filesystem size
         * and drop the blocks.
         */
-       if ( dblocks % agsize != 0 &&
+       if ( agcount * agsize > dblocks &&
+            dblocks % agsize != 0 &&
             (dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog))) {
                dblocks = (xfs_drfsbno_t)((agcount - 1) * agsize);
                agcount--;


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