+ if (inodecramped) {
+ if (inospercg > MAXIPG(&sblock)) {
+ printf("Minimum bytes per inode is %d\n",
+ (mincpg * bpcg - used) / MAXIPG(&sblock) + 1);
+ } else if (!mapcramped) {
+ printf("With %d bytes per inode, ", density);
+ printf("minimum cylinders per group is %d\n", mincpg);
+ }
+ }
+ if (mapcramped) {
+ printf("With %d sectors per cylinder, ", sblock.fs_spc);
+ printf("minimum cylinders per group is %d\n", mincpg);
+ }
+ if (inodecramped || mapcramped) {
+ if (sblock.fs_bsize != bsize)
+ printf("%s to be changed from %d to %d\n",
+ "This requires the block size",
+ bsize, sblock.fs_bsize);
+ if (sblock.fs_fsize != fsize)
+ printf("\t%s to be changed from %d to %d\n",
+ "and the fragment size",
+ fsize, sblock.fs_fsize);
+ exit(23);
+ }
+ /*
+ * Calculate the number of cylinders per group
+ */
+ sblock.fs_cpg = cpg;
+ if (sblock.fs_cpg % mincpc != 0) {
+ printf("%s groups must have a multiple of %d cylinders\n",
+ cpgflg ? "Cylinder" : "Warning: cylinder", mincpc);
+ sblock.fs_cpg = roundup(sblock.fs_cpg, mincpc);
+ if (!cpgflg)
+ cpg = sblock.fs_cpg;
+ }
+ /*
+ * Must ensure there is enough space for inodes.
+ */
+ sblock.fs_ipg = roundup((sblock.fs_cpg * bpcg - used) / density,
+ INOPB(&sblock));
+ while (sblock.fs_ipg > MAXIPG(&sblock)) {
+ inodecramped = 1;
+ sblock.fs_cpg -= mincpc;
+ sblock.fs_ipg = roundup((sblock.fs_cpg * bpcg - used) / density,
+ INOPB(&sblock));
+ }
+ /*
+ * Must ensure there is enough space to hold block map.
+ */
+ while (CGSIZE(&sblock) > sblock.fs_bsize) {
+ mapcramped = 1;
+ sblock.fs_cpg -= mincpc;
+ sblock.fs_ipg = roundup((sblock.fs_cpg * bpcg - used) / density,
+ INOPB(&sblock));