diff options
| author | Kirk McKusick <mckusick@FreeBSD.org> | 2010-11-23 01:24:27 +0000 |
|---|---|---|
| committer | Kirk McKusick <mckusick@FreeBSD.org> | 2010-11-23 01:24:27 +0000 |
| commit | 418c5546097d6b6f0327182d61b20b068770a2f3 (patch) | |
| tree | 63943442e2f2cf18d002b46cb66e3b1fc87732e1 | |
| parent | 07bb0fca365a687bf585b5cf4884c6b19b45b7f2 (diff) | |
Notes
| -rw-r--r-- | sbin/newfs/mkfs.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index b7a6b5217654..8e94fd04316f 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -376,16 +376,20 @@ restart: * Start packing more blocks into the cylinder group until * it cannot grow any larger, the number of cylinder groups * drops below MINCYLGRPS, or we reach the size requested. + * For UFS1 inodes per cylinder group are stored in an int16_t + * so fs_ipg is limited to 2^15 - 1. */ for ( ; sblock.fs_fpg < maxblkspercg; sblock.fs_fpg += sblock.fs_frag) { sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode), INOPB(&sblock)); - if (sblock.fs_size / sblock.fs_fpg < MINCYLGRPS) - break; - if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize) - continue; - if (CGSIZE(&sblock) == (unsigned long)sblock.fs_bsize) - break; + if (Oflag > 1 || (Oflag == 1 && sblock.fs_ipg <= 0x7fff)) { + if (sblock.fs_size / sblock.fs_fpg < MINCYLGRPS) + break; + if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize) + continue; + if (CGSIZE(&sblock) == (unsigned long)sblock.fs_bsize) + break; + } sblock.fs_fpg -= sblock.fs_frag; sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode), INOPB(&sblock)); @@ -584,8 +588,20 @@ restart: printf("** Exiting on Xflag 3\n"); exit(0); } - if (!Nflag) + if (!Nflag) { do_sbwrite(&disk); + /* + * For UFS1 filesystems with a blocksize of 64K, the first + * alternate superblock resides at the location used for + * the default UFS2 superblock. As there is a valid + * superblock at this location, the boot code will use + * it as its first choice. Thus we have to ensure that + * all of its statistcs on usage are correct. + */ + if (Oflag == 1 && sblock.fs_bsize == 65536) + wtfs(fsbtodb(&sblock, cgsblock(&sblock, 0)), + sblock.fs_bsize, (char *)&sblock); + } for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize) wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)), sblock.fs_cssize - i < sblock.fs_bsize ? |
