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

Eric Sandeen
2008-01-29T21:21:17Z

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--;