Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Nov 2010 22:24:17 +0000 (UTC)
From:      Brian Somers <brian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r214956 - in stable/8: sbin/growfs tools/regression/lib/msun tools/regression/sbin tools/regression/usr.bin/pkill tools/tools/ath/common tools/tools/termcap
Message-ID:  <201011072224.oA7MOH72088341@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brian
Date: Sun Nov  7 22:24:17 2010
New Revision: 214956
URL: http://svn.freebsd.org/changeset/base/214956

Log:
  MFC r197763 and r212839: Handle extending a filesystem into unzeroed storage.

Added:
  stable/8/tools/regression/sbin/
     - copied from r212839, head/tools/regression/sbin/
Modified:
  stable/8/sbin/growfs/growfs.c
Directory Properties:
  stable/8/sbin/growfs/   (props changed)
  stable/8/tools/   (props changed)
  stable/8/tools/build/mk/   (props changed)
  stable/8/tools/build/options/   (props changed)
  stable/8/tools/debugscripts/   (props changed)
  stable/8/tools/kerneldoc/subsys/   (props changed)
  stable/8/tools/regression/acltools/   (props changed)
  stable/8/tools/regression/aio/aiotest/   (props changed)
  stable/8/tools/regression/bin/sh/   (props changed)
  stable/8/tools/regression/fifo/   (props changed)
  stable/8/tools/regression/geom/   (props changed)
  stable/8/tools/regression/lib/libc/   (props changed)
  stable/8/tools/regression/lib/msun/test-conj.t   (props changed)
  stable/8/tools/regression/mqueue/mqtest1/   (props changed)
  stable/8/tools/regression/mqueue/mqtest2/   (props changed)
  stable/8/tools/regression/mqueue/mqtest3/   (props changed)
  stable/8/tools/regression/mqueue/mqtest4/   (props changed)
  stable/8/tools/regression/mqueue/mqtest5/   (props changed)
  stable/8/tools/regression/poll/   (props changed)
  stable/8/tools/regression/posixsem/   (props changed)
  stable/8/tools/regression/priv/   (props changed)
  stable/8/tools/regression/usr.bin/   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pgrep-_s.t   (props changed)
  stable/8/tools/regression/usr.bin/pkill/pkill-_g.t   (props changed)
  stable/8/tools/regression/usr.bin/sed/   (props changed)
  stable/8/tools/regression/usr.bin/tr/   (props changed)
  stable/8/tools/test/   (props changed)
  stable/8/tools/tools/   (props changed)
  stable/8/tools/tools/ath/   (props changed)
  stable/8/tools/tools/ath/common/dumpregs.h   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5210.c   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5211.c   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5212.c   (props changed)
  stable/8/tools/tools/ath/common/dumpregs_5416.c   (props changed)
  stable/8/tools/tools/nanobsd/   (props changed)
  stable/8/tools/tools/netrate/   (props changed)
  stable/8/tools/tools/netrate/tcpp/   (props changed)
  stable/8/tools/tools/termcap/termcap.pl   (props changed)
  stable/8/tools/tools/umastat/   (props changed)
  stable/8/tools/tools/vimage/   (props changed)

Modified: stable/8/sbin/growfs/growfs.c
==============================================================================
--- stable/8/sbin/growfs/growfs.c	Sun Nov  7 21:57:57 2010	(r214955)
+++ stable/8/sbin/growfs/growfs.c	Sun Nov  7 22:24:17 2010	(r214956)
@@ -371,16 +371,16 @@ static void
 initcg(int cylno, time_t utime, int fso, unsigned int Nflag)
 {
 	DBG_FUNC("initcg")
-	static void *iobuf;
+	static caddr_t iobuf;
 	long blkno, start;
 	ufs2_daddr_t i, cbase, dmax;
 	struct ufs1_dinode *dp1;
 	struct csum *cs;
 	uint d, dupper, dlower;
 
-	if (iobuf == NULL && (iobuf = malloc(sblock.fs_bsize)) == NULL) {
+	if (iobuf == NULL && (iobuf = malloc(sblock.fs_bsize * 3)) == NULL)
 		errx(37, "panic: cannot allocate I/O buffer");
-	}
+
 	/*
 	 * Determine block bounds for cylinder group.
 	 * Allow space for super block summary information in first
@@ -400,7 +400,8 @@ initcg(int cylno, time_t utime, int fso,
 	acg.cg_magic = CG_MAGIC;
 	acg.cg_cgx = cylno;
 	acg.cg_niblk = sblock.fs_ipg;
-	acg.cg_initediblk = sblock.fs_ipg;
+	acg.cg_initediblk = sblock.fs_ipg < 2 * INOPB(&sblock) ?
+	    sblock.fs_ipg : 2 * INOPB(&sblock);
 	acg.cg_ndblk = dmax - cbase;
 	if (sblock.fs_contigsumsize > 0)
 		acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag;
@@ -533,11 +534,14 @@ initcg(int cylno, time_t utime, int fso,
 	sblock.fs_cstotal.cs_nbfree += acg.cg_cs.cs_nbfree;
 	sblock.fs_cstotal.cs_nifree += acg.cg_cs.cs_nifree;
 	*cs = acg.cg_cs;
+
+	memcpy(iobuf, &acg, sblock.fs_cgsize);
+	memset(iobuf + sblock.fs_cgsize, '\0',
+	    sblock.fs_bsize * 3 - sblock.fs_cgsize);
+
 	wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)),
-		sblock.fs_bsize, (char *)&acg, fso, Nflag);
-	DBG_DUMP_CG(&sblock,
-	    "new cg",
-	    &acg);
+	    sblock.fs_bsize * 3, iobuf, fso, Nflag);
+	DBG_DUMP_CG(&sblock, "new cg", &acg);
 
 	DBG_LEAVE;
 	return;
@@ -2209,6 +2213,7 @@ main(int argc, char **argv)
 		printf("Warning: %jd sector(s) cannot be allocated.\n",
 		    (intmax_t)fsbtodb(&sblock, sblock.fs_size % sblock.fs_fpg));
 		sblock.fs_size = sblock.fs_ncg * sblock.fs_fpg;
+		maxino -= sblock.fs_ipg;
 	}
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011072224.oA7MOH72088341>