]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
force even number of 512-byte blocks when data/log/rt fills partition
authorEric Sandeen <sandeen@sgi.com>
Thu, 3 Jan 2002 21:39:35 +0000 (21:39 +0000)
committerEric Sandeen <sandeen@sgi.com>
Thu, 3 Jan 2002 21:39:35 +0000 (21:39 +0000)
growfs/xfs_growfs.c
mkfs/xfs_mkfs.c

index b078c1a1f028c691d69901e8a391cb5e991fe0a3..fdece8cad29aa2b615723c10fa15aecd5f932e32 100644 (file)
@@ -317,6 +317,17 @@ main(int argc, char **argv)
                        geo.logblocks * (geo.blocksize / BBSIZE) );
        drsize = xi.rtsize;
 
+       /*
+        * Ok, Linux only has a 1024-byte resolution on device _size_,
+        * and the sizes below are in basic 512-byte blocks,
+        * so if we have (size % 2), on any partition, we can't get
+        * to the last 512 bytes.  Just chop it down by a block.
+        */
+       
+       ddsize -= (ddsize % 2);
+       dlsize -= (dlsize % 2);
+       drsize -= (drsize % 2);
+
        error = 0;
        if (dflag | aflag) {
                xfs_growfs_data_t       in;
index 45e159c146ee2f072ca48acccd08a31dc466e0f1..9e34ebdf5229df357b5fdfa070c5c17f7ef9c4c1 100644 (file)
@@ -1119,6 +1119,17 @@ main(int argc, char **argv)
                usage();
        }
 
+       /*
+        * Ok, Linux only has a 1024-byte resolution on device _size_,
+        * and the sizes below are in basic 512-byte blocks,
+        * so if we have (size % 2), on any partition, we can't get
+        * to the last 512 bytes.  Just chop it down by a block.
+        */
+
+       xi.dsize -= (xi.dsize % 2);
+       xi.rtsize -= (xi.rtsize % 2);
+       xi.logBBsize -= (xi.logBBsize % 2);
+
        if (!force_overwrite) {
                if (check_overwrite(dfile) ||
                    check_overwrite(logfile) ||