From owner-svn-src-stable-9@FreeBSD.ORG Sat Jun 23 18:58:02 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAB371065672; Sat, 23 Jun 2012 18:58:02 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2DE28FC0A; Sat, 23 Jun 2012 18:58:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NIw25n058625; Sat, 23 Jun 2012 18:58:02 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5NIw2I8058622; Sat, 23 Jun 2012 18:58:02 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201206231858.q5NIw2I8058622@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 23 Jun 2012 18:58:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237497 - stable/9/sbin/growfs X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 18:58:02 -0000 Author: trasz Date: Sat Jun 23 18:58:02 2012 New Revision: 237497 URL: http://svn.freebsd.org/changeset/base/237497 Log: MFC r232548: Make growfs(8) mostly style compliant. No functional changes, verified with MD5. MFC r232858: After r232548, clang complains about the apparent '=-' operator (a left-over from ancient C times, and a frequent typo) in growfs.c: sbin/growfs/growfs.c:1550:8: error: use of unary operator that may be intended as compound assignment (-=) [-Werror] blkno =- 1; ^~ Use 'blkno = -1' instead, to silence the error. Modified: stable/9/sbin/growfs/debug.c stable/9/sbin/growfs/growfs.c Directory Properties: stable/9/sbin/growfs/ (props changed) Modified: stable/9/sbin/growfs/debug.c ============================================================================== --- stable/9/sbin/growfs/debug.c Sat Jun 23 18:54:24 2012 (r237496) +++ stable/9/sbin/growfs/debug.c Sat Jun 23 18:58:02 2012 (r237497) @@ -44,7 +44,6 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -/* ********************************************************** INCLUDES ***** */ #include #include @@ -57,15 +56,13 @@ static const char rcsid[] = #ifdef FS_DEBUG -/* *********************************************************** GLOBALS ***** */ -static FILE *dbg_log=NULL; -static unsigned int indent=0; +static FILE *dbg_log = NULL; +static unsigned int indent = 0; /* * prototypes not done here, as they come with debug.h */ -/* ********************************************************** dbg_open ***** */ /* * Open the filehandle where all debug output has to go. */ @@ -74,14 +71,13 @@ dbg_open(const char *fn) { if (strcmp(fn, "-") == 0) - dbg_log=fopen("/dev/stdout", "a"); + dbg_log = fopen("/dev/stdout", "a"); else - dbg_log=fopen(fn, "a"); + dbg_log = fopen(fn, "a"); return; } -/* ********************************************************* dbg_close ***** */ /* * Close the filehandle where all debug output went to. */ @@ -89,15 +85,14 @@ void dbg_close(void) { - if(dbg_log) { + if (dbg_log) { fclose(dbg_log); - dbg_log=NULL; + dbg_log = NULL; } return; } -/* ****************************************************** dbg_dump_hex ***** */ /* * Dump out a full file system block in hex. */ @@ -106,17 +101,16 @@ dbg_dump_hex(struct fs *sb, const char * { int i, j, k; - if(!dbg_log) { + if (!dbg_log) return; - } + fprintf(dbg_log, "===== START HEXDUMP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)mem, comment); indent++; - for (i=0; ifs_bsize; i+=24) { - for (j=0; j<3; j++) { - for (k=0; k<8; k++) { + for (i = 0; i < sb->fs_bsize; i += 24) { + for (j = 0; j < 3; j++) { + for (k = 0; k < 8; k++) fprintf(dbg_log, "%02x ", *mem++); - } fprintf(dbg_log, " "); } fprintf(dbg_log, "\n"); @@ -127,7 +121,6 @@ dbg_dump_hex(struct fs *sb, const char * return; } -/* ******************************************************* dbg_dump_fs ***** */ /* * Dump the superblock. */ @@ -135,12 +128,11 @@ void dbg_dump_fs(struct fs *sb, const char *comment) { #ifdef FSMAXSNAP - int j; + int j; #endif /* FSMAXSNAP */ - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START SUPERBLOCK =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)sb, comment); @@ -308,10 +300,10 @@ dbg_dump_fs(struct fs *sb, const char *c sb->fs_pendinginodes); #ifdef FSMAXSNAP - for(j=0; jfs_snapinum[j]); - if(!sb->fs_snapinum[j]) { /* list is dense */ + if (!sb->fs_snapinum[j]) { /* list is dense */ break; } } @@ -356,7 +348,6 @@ dbg_dump_fs(struct fs *sb, const char *c return; } -/* ******************************************************* dbg_dump_cg ***** */ /* * Dump a cylinder group. */ @@ -365,9 +356,8 @@ dbg_dump_cg(const char *comment, struct { int j; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START CYLINDER GROUP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment); @@ -383,7 +373,7 @@ dbg_dump_cg(const char *comment, struct fprintf(dbg_log, "rotor int32_t 0x%08x\n", cgr->cg_rotor); fprintf(dbg_log, "frotor int32_t 0x%08x\n", cgr->cg_frotor); fprintf(dbg_log, "irotor int32_t 0x%08x\n", cgr->cg_irotor); - for(j=0; jcg_frsum[j]); } @@ -411,7 +401,6 @@ dbg_dump_cg(const char *comment, struct return; } -/* ***************************************************** dbg_dump_csum ***** */ /* * Dump a cylinder summary. */ @@ -419,9 +408,8 @@ void dbg_dump_csum(const char *comment, struct csum *cs) { - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START CYLINDER SUMMARY =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cs, comment); @@ -438,7 +426,6 @@ dbg_dump_csum(const char *comment, struc return; } -/* ************************************************ dbg_dump_csum_total ***** */ /* * Dump a cylinder summary. */ @@ -446,9 +433,8 @@ void dbg_dump_csum_total(const char *comment, struct csum_total *cs) { - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START CYLINDER SUMMARY TOTAL =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cs, comment); @@ -475,7 +461,6 @@ dbg_dump_csum_total(const char *comment, return; } -/* **************************************************** dbg_dump_inmap ***** */ /* * Dump the inode allocation map in one cylinder group. */ @@ -485,30 +470,29 @@ dbg_dump_inmap(struct fs *sb, const char int j,k,l,e; unsigned char *cp; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START INODE ALLOCATION MAP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment); indent++; - cp=(unsigned char *)cg_inosused(cgr); - e=sb->fs_ipg/8; - for(j=0; jfs_ipg / 8; + for (j = 0; j < e; j += 32) { fprintf(dbg_log, "%08x: ", j); - for(k=0; k<32; k+=8) { - if(j+k+8fs_old_nspf) - e=howmany((sb->fs_old_cpg * sb->fs_old_spc / sb->fs_old_nspf), CHAR_BIT); + e = howmany((sb->fs_old_cpg * sb->fs_old_spc / sb->fs_old_nspf), CHAR_BIT); else e = 0; - for(j=0; jfs_old_nspf) - e=howmany(sb->fs_old_cpg * sb->fs_old_spc / (sb->fs_old_nspf << sb->fs_fragshift), CHAR_BIT); + e = howmany(sb->fs_old_cpg * sb->fs_old_spc / (sb->fs_old_nspf << sb->fs_fragshift), CHAR_BIT); else e = 0; - for(j=0; jfs_contigsumsize; j++) { + ip = (int *)cg_clustersum(cgr); + for (j = 0; j <= sb->fs_contigsumsize; j++) { fprintf(dbg_log, "%02d: %8d\n", j, *ip++); } @@ -651,7 +629,6 @@ dbg_dump_clsum(struct fs *sb, const char * will leave it disabled for now; it should probably be re-enabled * specifically for UFS1. */ -/* **************************************************** dbg_dump_sptbl ***** */ /* * Dump the block summary, and the rotational layout table. */ @@ -661,23 +638,21 @@ dbg_dump_sptbl(struct fs *sb, const char int j,k; int *ip; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START BLOCK SUMMARY AND POSITION TABLE =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment); indent++; - ip=(int *)cg_blktot(cgr); - for(j=0; jfs_old_cpg; j++) { + ip = (int *)cg_blktot(cgr); + for (j = 0; j < sb->fs_old_cpg; j++) { fprintf(dbg_log, "%2d: %5d = ", j, *ip++); - for(k=0; kfs_old_nrpos; k++) { + for (k = 0; k < sb->fs_old_nrpos; k++) { fprintf(dbg_log, "%4d", cg_blks(sb, cgr, j)[k]); - if(kfs_old_nrpos-1) { + if (k < sb->fs_old_nrpos - 1) fprintf(dbg_log, " + "); - } } fprintf(dbg_log, "\n"); } @@ -689,7 +664,6 @@ dbg_dump_sptbl(struct fs *sb, const char } #endif -/* ************************************************** dbg_dump_ufs1_ino ***** */ /* * Dump a UFS1 inode structure. */ @@ -699,9 +673,8 @@ dbg_dump_ufs1_ino(struct fs *sb, const c int ictr; int remaining_blocks; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START UFS1 INODE DUMP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment); @@ -723,25 +696,25 @@ dbg_dump_ufs1_ino(struct fs *sb, const c fprintf(dbg_log, "ctimensec int32_t 0x%08x\n", ino->di_ctimensec); - remaining_blocks=howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */ - for(ictr=0; ictr < MIN(NDADDR, remaining_blocks); ictr++) { + remaining_blocks = howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */ + for (ictr = 0; ictr < MIN(NDADDR, remaining_blocks); ictr++) { fprintf(dbg_log, "db ufs_daddr_t[%x] 0x%08x\n", ictr, ino->di_db[ictr]); } - remaining_blocks-=NDADDR; - if(remaining_blocks>0) { + remaining_blocks -= NDADDR; + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs_daddr_t[0] 0x%08x\n", ino->di_ib[0]); } - remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs1_daddr_t)); - if(remaining_blocks>0) { + remaining_blocks -= howmany(sb->fs_bsize, sizeof(ufs1_daddr_t)); + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs_daddr_t[1] 0x%08x\n", ino->di_ib[1]); } -#define SQUARE(a) ((a)*(a)) - remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs1_daddr_t))); +#define SQUARE(a) ((a) * (a)) + remaining_blocks -= SQUARE(howmany(sb->fs_bsize, sizeof(ufs1_daddr_t))); #undef SQUARE - if(remaining_blocks>0) { + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs_daddr_t[2] 0x%08x\n", ino->di_ib[2]); } @@ -758,7 +731,6 @@ dbg_dump_ufs1_ino(struct fs *sb, const c return; } -/* ************************************************** dbg_dump_ufs2_ino ***** */ /* * Dump a UFS2 inode structure. */ @@ -768,9 +740,8 @@ dbg_dump_ufs2_ino(struct fs *sb, const c int ictr; int remaining_blocks; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START UFS2 INODE DUMP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment); @@ -785,8 +756,8 @@ dbg_dump_ufs2_ino(struct fs *sb, const c ((unsigned int *)&(ino->di_size))[1], ((unsigned int *)&(ino->di_size))[0]); fprintf(dbg_log, "blocks u_int64_t 0x%08x%08x\n", - ((unsigned int *)&(ino->di_blocks))[1], - ((unsigned int *)&(ino->di_blocks))[0]); + ((unsigned int *)&(ino->di_blocks))[1], + ((unsigned int *)&(ino->di_blocks))[0]); fprintf(dbg_log, "atime ufs_time_t %10jd\n", ino->di_atime); fprintf(dbg_log, "mtime ufs_time_t %10jd\n", ino->di_mtime); fprintf(dbg_log, "ctime ufs_time_t %10jd\n", ino->di_ctime); @@ -802,25 +773,25 @@ dbg_dump_ufs2_ino(struct fs *sb, const c /* XXX: What do we do with di_extb[NXADDR]? */ - remaining_blocks=howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */ - for(ictr=0; ictr < MIN(NDADDR, remaining_blocks); ictr++) { + remaining_blocks = howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */ + for (ictr = 0; ictr < MIN(NDADDR, remaining_blocks); ictr++) { fprintf(dbg_log, "db ufs2_daddr_t[%x] 0x%16jx\n", ictr, ino->di_db[ictr]); } - remaining_blocks-=NDADDR; - if(remaining_blocks>0) { + remaining_blocks -= NDADDR; + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs2_daddr_t[0] 0x%16jx\n", ino->di_ib[0]); } - remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs2_daddr_t)); - if(remaining_blocks>0) { + remaining_blocks -= howmany(sb->fs_bsize, sizeof(ufs2_daddr_t)); + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs2_daddr_t[1] 0x%16jx\n", ino->di_ib[1]); } -#define SQUARE(a) ((a)*(a)) - remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs2_daddr_t))); +#define SQUARE(a) ((a) * (a)) + remaining_blocks -= SQUARE(howmany(sb->fs_bsize, sizeof(ufs2_daddr_t))); #undef SQUARE - if(remaining_blocks>0) { + if (remaining_blocks > 0) { fprintf(dbg_log, "ib ufs2_daddr_t[2] 0x%16jx\n", ino->di_ib[2]); } @@ -831,7 +802,6 @@ dbg_dump_ufs2_ino(struct fs *sb, const c return; } -/* ***************************************************** dbg_dump_iblk ***** */ /* * Dump an indirect block. The iteration to dump a full file has to be * written around. @@ -841,9 +811,8 @@ dbg_dump_iblk(struct fs *sb, const char { unsigned int *mem, i, j, size; - if(!dbg_log) { + if (!dbg_log) return; - } fprintf(dbg_log, "===== START INDIRECT BLOCK DUMP =====\n"); fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)block, @@ -855,14 +824,13 @@ dbg_dump_iblk(struct fs *sb, const char else size = sizeof(ufs2_daddr_t); - mem=(unsigned int *)block; - for (i=0; (size_t)ifs_bsize, size), - length); i+=8) { + mem = (unsigned int *)block; + for (i = 0; (size_t)i < MIN(howmany(sb->fs_bsize, size), length); + i += 8) { fprintf(dbg_log, "%04x: ", i); - for (j=0; j<8; j++) { - if((size_t)(i+j) __FBSDID("$FreeBSD$"); -/* ********************************************************** INCLUDES ***** */ #include #include #include @@ -72,7 +71,6 @@ __FBSDID("$FreeBSD$"); #include "debug.h" -/* *************************************************** GLOBALS & TYPES ***** */ #ifdef FS_DEBUG int _dbg_lvl_ = (DL_INFO); /* DL_TRC */ #endif /* FS_DEBUG */ @@ -117,7 +115,7 @@ union dinode { static ufs2_daddr_t inoblk; /* inode block address */ static char inobuf[MAXBSIZE]; /* inode block */ static ino_t maxino; /* last valid inode */ -static int unlabeled; /* unlabeled partition, e.g. vinum volume etc. */ +static int unlabeled; /* unlabeled partition, e.g. vinum volume */ /* * An array of elements of type struct gfs_bpp describes all blocks to @@ -130,10 +128,9 @@ struct gfs_bpp { #define GFS_FL_FIRST 1 #define GFS_FL_LAST 2 unsigned int flags; /* special handling required */ - int found; /* how many references were updated */ + int found; /* how many references were updated */ }; -/* ******************************************************** PROTOTYPES ***** */ static void growfs(int, int, unsigned int); static void rdfs(ufs2_daddr_t, size_t, void *, int); static void wtfs(ufs2_daddr_t, size_t, void *, int, unsigned int); @@ -158,7 +155,6 @@ static void indirchk(ufs_lbn_t, ufs_lbn_ struct gfs_bpp *, int, int, unsigned int); static void get_dev_size(int, int *); -/* ************************************************************ growfs ***** */ /* * Here we actually start growing the file system. We basically read the * cylinder summary from the first cylinder group as we want to update @@ -174,12 +170,12 @@ static void growfs(int fsi, int fso, unsigned int Nflag) { DBG_FUNC("growfs") - time_t modtime; - uint cylno; - int i, j, width; - char tmpbuf[100]; + time_t modtime; + uint cylno; + int i, j, width; + char tmpbuf[100]; #ifdef FSIRAND - static int randinit=0; + static int randinit=0; DBG_ENTER; @@ -198,37 +194,35 @@ growfs(int fsi, int fso, unsigned int Nf * Get the cylinder summary into the memory. */ fscs = (struct csum *)calloc((size_t)1, (size_t)sblock.fs_cssize); - if(fscs == NULL) { + if (fscs == NULL) errx(1, "calloc failed"); - } for (i = 0; i < osblock.fs_cssize; i += osblock.fs_bsize) { rdfs(fsbtodb(&osblock, osblock.fs_csaddr + numfrags(&osblock, i)), (size_t)MIN(osblock.fs_cssize - i, - osblock.fs_bsize), (void *)(((char *)fscs)+i), fsi); + osblock.fs_bsize), (void *)(((char *)fscs) + i), fsi); } #ifdef FS_DEBUG -{ - struct csum *dbg_csp; - int dbg_csc; - char dbg_line[80]; - - dbg_csp=fscs; - for(dbg_csc=0; dbg_csc= width) { printf("\n"); i = 0; @@ -288,20 +282,18 @@ growfs(int fsi, int fso, unsigned int Nf DBG_PRINT0("fscs written\n"); #ifdef FS_DEBUG -{ - struct csum *dbg_csp; - int dbg_csc; - char dbg_line[80]; - - dbg_csp=fscs; - for(dbg_csc=0; dbg_csc 0) @@ -549,7 +538,6 @@ initcg(int cylno, time_t modtime, int fs return; } -/* ******************************************************* frag_adjust ***** */ /* * Here we add or subtract (sign +1/-1) the available fragments in a given * block to or from the fragment statistics. By subtracting before and adding @@ -570,45 +558,38 @@ frag_adjust(ufs2_daddr_t frag, int sign) * Here frag only needs to point to any fragment in the block we want * to examine. */ - for(f=rounddown(frag, sblock.fs_frag); - ffound++; DBG_PRINT3("scg (%jd->%jd)[%d] reference updated\n", - (intmax_t)f->old, - (intmax_t)f->new, - fragnum); + (intmax_t)f->old, (intmax_t)f->new, fragnum); /* * Copy the block back immediately. @@ -669,7 +648,6 @@ cond_bl_upd(ufs2_daddr_t *block, struct return (0); } -/* ************************************************************ updjcg ***** */ /* * Here we do all needed work for the former last cylinder group. It has to be * changed in any case, even if the file system ended exactly on the end of @@ -685,10 +663,10 @@ static void updjcg(int cylno, time_t modtime, int fsi, int fso, unsigned int Nflag) { DBG_FUNC("updjcg") - ufs2_daddr_t cbase, dmax, dupper; - struct csum *cs; - int i,k; - int j=0; + ufs2_daddr_t cbase, dmax, dupper; + struct csum *cs; + int i, k; + int j = 0; DBG_ENTER; @@ -699,9 +677,7 @@ updjcg(int cylno, time_t modtime, int fs rdfs(fsbtodb(&osblock, cgtod(&osblock, cylno)), (size_t)osblock.fs_cgsize, (void *)&aocg, fsi); DBG_PRINT0("jcg read\n"); - DBG_DUMP_CG(&sblock, - "old joining cg", - &aocg); + DBG_DUMP_CG(&sblock, "old joining cg", &aocg); memcpy((void *)&cgun1, (void *)&cgun2, sizeof(cgun2)); @@ -713,16 +689,14 @@ updjcg(int cylno, time_t modtime, int fs * cylinder group we have to change that value now to fs_cpg. */ - if(cgbase(&osblock, cylno+1) == osblock.fs_size) { + if (cgbase(&osblock, cylno + 1) == osblock.fs_size) { if (sblock.fs_magic == FS_UFS1_MAGIC) acg.cg_old_ncyl=sblock.fs_old_cpg; wtfs(fsbtodb(&sblock, cgtod(&sblock, cylno)), (size_t)sblock.fs_cgsize, (void *)&acg, fso, Nflag); DBG_PRINT0("jcg written\n"); - DBG_DUMP_CG(&sblock, - "new joining cg", - &acg); + DBG_DUMP_CG(&sblock, "new joining cg", &acg); DBG_LEAVE; return; @@ -736,9 +710,8 @@ updjcg(int cylno, time_t modtime, int fs if (dmax > sblock.fs_size) dmax = sblock.fs_size; dupper = cgdmin(&sblock, cylno) - cbase; - if (cylno == 0) { /* XXX fscs may be relocated */ + if (cylno == 0) /* XXX fscs may be relocated */ dupper += howmany(sblock.fs_cssize, sblock.fs_fsize); - } /* * Set pointer to the cylinder summary for our cylinder group. @@ -760,21 +733,16 @@ updjcg(int cylno, time_t modtime, int fs } else { acg.cg_old_ncyl = sblock.fs_old_cpg; } - DBG_PRINT2("jcg dbg: %d %u", - cylno, - sblock.fs_ncg); + DBG_PRINT2("jcg dbg: %d %u", cylno, sblock.fs_ncg); #ifdef FS_DEBUG if (sblock.fs_magic == FS_UFS1_MAGIC) - DBG_PRINT2("%d %u", - acg.cg_old_ncyl, - sblock.fs_old_cpg); + DBG_PRINT2("%d %u", acg.cg_old_ncyl, sblock.fs_old_cpg); #endif DBG_PRINT0("\n"); acg.cg_ndblk = dmax - cbase; - sblock.fs_dsize += acg.cg_ndblk-aocg.cg_ndblk; - if (sblock.fs_contigsumsize > 0) { + sblock.fs_dsize += acg.cg_ndblk - aocg.cg_ndblk; + if (sblock.fs_contigsumsize > 0) acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag; - } /* * Now we have to update the free fragment bitmap for our new free @@ -788,15 +756,16 @@ updjcg(int cylno, time_t modtime, int fs * Handle the first new block here if it was partially available * before. */ - if(osblock.fs_size % sblock.fs_frag) { - if(roundup(osblock.fs_size, sblock.fs_frag)<=sblock.fs_size) { + if (osblock.fs_size % sblock.fs_frag) { + if (roundup(osblock.fs_size, sblock.fs_frag) <= + sblock.fs_size) { /* * The new space is enough to fill at least this * block */ - j=0; - for(i=roundup(osblock.fs_size-cbase, sblock.fs_frag)-1; - i>=osblock.fs_size-cbase; + j = 0; + for (i = roundup(osblock.fs_size - cbase, + sblock.fs_frag) - 1; i >= osblock.fs_size - cbase; i--) { setbit(cg_blksfree(&acg), i); acg.cg_cs.cs_nffree++; @@ -808,44 +777,43 @@ updjcg(int cylno, time_t modtime, int fs * already existing fragment at the former end of the * file system. */ - if(isblock(&sblock, cg_blksfree(&acg), - ((osblock.fs_size - cgbase(&sblock, cylno))/ - sblock.fs_frag))) { + if (isblock(&sblock, cg_blksfree(&acg), + ((osblock.fs_size - cgbase(&sblock, cylno)) / + sblock.fs_frag))) { /* * The block is now completely available. */ DBG_PRINT0("block was\n"); - acg.cg_frsum[osblock.fs_size%sblock.fs_frag]--; + acg.cg_frsum[osblock.fs_size % sblock.fs_frag]--; acg.cg_cs.cs_nbfree++; - acg.cg_cs.cs_nffree-=sblock.fs_frag; - k=rounddown(osblock.fs_size-cbase, + acg.cg_cs.cs_nffree -= sblock.fs_frag; + k = rounddown(osblock.fs_size - cbase, + sblock.fs_frag); + updclst((osblock.fs_size - cbase) / sblock.fs_frag); - updclst((osblock.fs_size-cbase)/sblock.fs_frag); } else { /* * Lets rejoin a possible partially growed * fragment. */ - k=0; - while(isset(cg_blksfree(&acg), i) && - (i>=rounddown(osblock.fs_size-cbase, + k = 0; + while (isset(cg_blksfree(&acg), i) && + (i >= rounddown(osblock.fs_size - cbase, sblock.fs_frag))) { i--; k++; } - if(k) { + if (k) acg.cg_frsum[k]--; - } - acg.cg_frsum[k+j]++; + acg.cg_frsum[k + j]++; } } else { /* * We only grow by some fragments within this last * block. *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***