]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Merge irix6.5f:irix:118221a
authorEric Sandeen <sandeen@sgi.com>
Mon, 6 May 2002 17:19:32 +0000 (17:19 +0000)
committerEric Sandeen <sandeen@sgi.com>
Mon, 6 May 2002 17:19:32 +0000 (17:19 +0000)
Fix the way mkfs round downs the device when the last AG is maller than the
minimum AG size.

mkfs/xfs_mkfs.c

index e6d711e489aaf298a39923ddd8769083004d24e1..b1801b32eee9e4f38294656e818c0c94cd505980 100644 (file)
@@ -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);
        }
 
        /*