From: Eric Sandeen Date: Mon, 6 May 2002 17:19:32 +0000 (+0000) Subject: Merge irix6.5f:irix:118221a X-Git-Tag: v2.1.0~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28eb00705530a78a408f1acd15aaccf3f8a79e6f;p=thirdparty%2Fxfsprogs-dev.git Merge irix6.5f:irix:118221a Fix the way mkfs round downs the device when the last AG is maller than the minimum AG size. --- diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index e6d711e48..b1801b32e 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1395,13 +1395,14 @@ main(int argc, char **argv) } /* - * if user set the AG size, and if the last AG is too small, - * reduce the filesystem size and drop the blocks. + * If the last AG is too small, reduce the filesystem size + * and drop the blocks. */ - if (!daflag && - (dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog))) { - dblocks -= dblocks % agsize; + if ( dblocks % agsize != 0 && + (dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog))) { + dblocks = (xfs_drfsbno_t)((agcount - 1) * agsize); agcount--; + ASSERT(agcount != 0); } /* @@ -1411,14 +1412,17 @@ main(int argc, char **argv) if (!daflag && !dasize && (agsize > XFS_AG_BEST_BLOCKS(blocklog,dblocks))) { agsize = XFS_AG_BEST_BLOCKS(blocklog,dblocks); + agcount = dblocks / agsize + (dblocks % agsize != 0); /* * If the last AG is too small, reduce the filesystem size * and drop the blocks. */ - if (dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog)) { - dblocks -= dblocks % agsize; + if ( dblocks % agsize != 0 && + (dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog))) { + dblocks = (xfs_drfsbno_t)((agcount - 1) * agsize); + agcount--; + ASSERT(agcount != 0); } - agcount = dblocks / agsize + (dblocks % agsize != 0); } /*