From b7abc84631c1a614b37ebad6a4fc77d15896c849 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Thu, 3 Jan 2002 21:39:35 +0000 Subject: [PATCH] force even number of 512-byte blocks when data/log/rt fills partition --- growfs/xfs_growfs.c | 11 +++++++++++ mkfs/xfs_mkfs.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c index b078c1a1f..fdece8cad 100644 --- a/growfs/xfs_growfs.c +++ b/growfs/xfs_growfs.c @@ -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; diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 45e159c14..9e34ebdf5 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -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) || -- 2.47.2