Lines Matching +full:boot +full:- +full:blks
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
10 * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
66 * make file system for cylinder-group style file systems
69 #define POWEROF2(num) (((num) & ((num) - 1)) == 0)
73 * to represent the variable-length data that followed the fixed structure.
75 * newfs would put in a CG, since newfs thought that the fixed-size header
83 * now artificially reduce the amount of space that the variable-length data
94 (dp)->dp1.field : (dp)->dp2.field)
167 wtfs(fssize - (realsectorsize / DEV_BSIZE), realsectorsize,
254 sblock.fs_bmask = ~(sblock.fs_bsize - 1);
255 sblock.fs_fmask = ~(sblock.fs_fsize - 1);
311 sblock.fs_maxfilesize = sblock.fs_bsize * UFS_NDADDR - 1;
341 maxinum = (((int64_t)(1)) << 32) - INOPB(&sblock);
377 if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize -
380 density -= sblock.fs_fsize;
389 * so fs_ipg is limited to 2^15 - 1.
397 if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize -
400 if (CGSIZE(&sblock) == (unsigned long)sblock.fs_bsize -
404 sblock.fs_fpg -= sblock.fs_frag;
428 sblock.fs_fpg -= sblock.fs_frag;
460 else if (metaspace != -1)
480 sblock.fs_dsize = sblock.fs_size - sblock.fs_sblkno -
481 sblock.fs_ncg * (sblock.fs_dblkno - sblock.fs_sblkno);
483 fragstoblks(&sblock, sblock.fs_dsize) -
488 sblock.fs_frag - fragnum(&sblock, csfrags) : 0);
490 sblock.fs_ncg * sblock.fs_ipg - UFS_ROOTINO;
492 sblock.fs_dsize -= csfrags;
504 * Set flags for metadata that is being check-hashed.
527 printf("\tusing %d cylinder groups of %.2fMB, %d blks, %d inodes.\n",
537 fsbtodb(&sblock, sblock.fs_size) - 1);
539 sblock.fs_size * sblock.fs_fsize - sblock.fs_sblockloc);
547 if (i == -1)
583 printf("super-block backups (for fsck_ffs -b #) at:\n");
602 cg < (sblock.fs_ncg-1) ? "," : "");
618 * then write out the super-block.
637 * superblock at this location, the boot code will use
645 * Read the last sector of the boot block, replace the last
652 part_ofs + (SBLOCK_UFS2 - realsectorsize) / disk.d_bsize,
653 fsrbuf, realsectorsize) == -1)
655 fsr = (struct fsrecovery *)&fsrbuf[realsectorsize - sizeof *fsr];
659 fsr->fsr_magic = sblock.fs_magic;
660 fsr->fsr_fpg = sblock.fs_fpg;
661 fsr->fsr_fsbtodb = sblock.fs_fsbtodb;
662 fsr->fsr_sblkno = sblock.fs_sblkno;
663 fsr->fsr_ncg = sblock.fs_ncg;
665 wtfs((SBLOCK_UFS2 - realsectorsize) / disk.d_bsize,
673 pp->p_fstype = FS_BSDFFS;
674 pp->p_fsize = sblock.fs_fsize;
675 pp->p_frag = sblock.fs_frag;
676 pp->p_cpg = sblock.fs_fpg;
689 maxblkspercg = fragstoblks(&sblock, sblock.fs_fpg) - 1;
718 dlower = cgsblock(&sblock, cylno) - cbase;
719 dupper = cgdmin(&sblock, cylno) - cbase;
729 acg.cg_ndblk = dmax - cbase;
753 acg.cg_clustersumoff -= sizeof(u_int32_t);
761 acg.cg_nextfreeoff - (unsigned)sblock.fs_cgsize);
768 acg.cg_cs.cs_nifree--;
773 * for boot and super blocks.
784 acg.cg_frsum[sblock.fs_frag - i]++;
785 for (d = dupper + sblock.fs_frag - i; dupper < d; dupper++) {
799 acg.cg_frsum[acg.cg_ndblk - d]++;
821 if ((i & (CHAR_BIT - 1)) != CHAR_BIT - 1)
852 dp1->di_gen = newfs_random();
855 dp2->di_gen = newfs_random();
869 dp1->di_gen = newfs_random();
906 gid = grp->gr_gid;
911 entries = (nflag) ? ROOTLINKCNT - 1: ROOTLINKCNT;
1000 for (cp = iobuf, i = 0; i < entries - 1; i++) {
1004 spcleft -= protodir[i].d_reclen;
1040 acg.cg_cs.cs_nbfree--;
1041 sblock.fs_cstotal.cs_nbfree--;
1042 fscs[0].cs_nbfree--;
1050 fscs[0].cs_nffree += sblock.fs_frag - frag;
1051 sblock.fs_cstotal.cs_nffree += sblock.fs_frag - frag;
1052 acg.cg_cs.cs_nffree += sblock.fs_frag - frag;
1053 acg.cg_frsum[sblock.fs_frag - frag]++;
1076 acg.cg_cs.cs_nifree--;
1080 sblock.fs_cstotal.cs_nifree--;
1081 fscs[0].cs_nifree--;
1082 if (getinode(&disk, &dp, ino) == -1) {
1087 *dp.dp1 = ip->dp1;
1089 *dp.dp2 = ip->dp2;
1113 switch (fs->fs_frag) {
1126 fprintf(stderr, "isblock bad fs_frag %d\n", fs->fs_frag);
1137 switch ((fs)->fs_frag) {
1151 fprintf(stderr, "clrblock bad fs_frag %d\n", fs->fs_frag);
1162 switch (fs->fs_frag) {
1176 fprintf(stderr, "setblock bad fs_frag %d\n", fs->fs_frag);
1194 if (ioctl(0, TIOCGWINSZ, &ws) != -1)