From: Eric Sandeen Date: Mon, 3 May 2004 22:35:41 +0000 (+0000) Subject: zero more at end of device at mkfs time, be sure to X-Git-Tag: v2.7.0~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c617c87b784f94da0df75235df7a86e3d14d0f0;p=thirdparty%2Fxfsprogs-dev.git zero more at end of device at mkfs time, be sure to get any old md superblock (which throws off mount-by-label) bump version --- diff --git a/VERSION b/VERSION index 80f357450..92b207540 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=2 PKG_MINOR=6 -PKG_REVISION=12 +PKG_REVISION=13 PKG_BUILD=1 diff --git a/doc/CHANGES b/doc/CHANGES index ca91e93db..72383c687 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,7 @@ +xfsprogs-2.6.13 (03 May 2004) + - zero out more at beginning and end of device at mkfs time + (get all old MD superblocks at the end, for mount by label). + xfsprogs-2.6.12 (30 April 2004) - Extract stripe unit/width from device mapper devices (added libdisk infrastructure, used by mkfs.xfs). diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 61c1f65bc..10ca6ebcf 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -185,6 +185,11 @@ char *sopts[] = { ((uint)(MKFS_BLOCKRES_INODE + XFS_DA_NODE_MAXDEPTH + \ (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1) + (rb))) +/* amount (in bytes) we zero at the beginning and end of the device to + * remove traces of other filesystems, raid superblocks, etc. + */ +#define WHACK_SIZE (128 * 1024) + static void calc_stripe_factors( int dsu, @@ -1934,13 +1939,13 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), (sectorsize != BBSIZE || lsectorsize != BBSIZE), 0); sbp->sb_features2 = XFS_SB_VERSION2_MKFS(0); /* - * Zero out the first 68k in on the device, to obliterate any old + * Zero out the beginning of the device, to obliterate any old * filesystem signatures out there. This should take care of * swap (somewhere around the page size), jfs (32k), * ext[2,3] and reiserfs (64k) - and hopefully all else. */ - buf = libxfs_getbuf(xi.ddev, 0, 136); - bzero(XFS_BUF_PTR(buf), 136*BBSIZE); + buf = libxfs_getbuf(xi.ddev, 0, BTOBB(WHACK_SIZE)); + bzero(XFS_BUF_PTR(buf), WHACK_SIZE); libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); /* OK, now write the superblock */ @@ -1962,13 +1967,14 @@ an AG size that is one stripe unit smaller, for example %llu.\n"), } /* - * Zero out the last 64k on the device, to obliterate any + * Zero out the end of the device, to obliterate any * old MD RAID (or other) metadata at the end of the device. + * (MD sb is ~64k from the end, take out a wider swath to be sure) */ if (!xi.disfile) { - buf = libxfs_getbuf(xi.ddev, (xi.dsize - BTOBB(65536)), - BTOBB(65536)); - bzero(XFS_BUF_PTR(buf), 65536); + buf = libxfs_getbuf(xi.ddev, (xi.dsize - BTOBB(WHACK_SIZE)), + BTOBB(WHACK_SIZE)); + bzero(XFS_BUF_PTR(buf), WHACK_SIZE); libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); }