Lines Matching refs:cgp
103 (struct fs *fs, struct cg *cgp, ufs_daddr_t blkno, int cnt);
756 register struct cg *cgp;
784 cgp = (struct cg *)buf_dataptr(bp);
787 byte_swap_cgin(cgp, fs);
791 if (!cg_chkmagic(cgp)) {
794 byte_swap_cgout(cgp,fs);
800 cgp->cg_time = tv.tv_sec;
803 if (isclr(cg_blksfree(cgp), bno + i)) {
806 byte_swap_cgout(cgp,fs);
818 if (isclr(cg_blksfree(cgp), bno + i))
820 cgp->cg_frsum[i - numfrags(fs, osize)]--;
822 cgp->cg_frsum[i - frags]++;
824 clrbit(cg_blksfree(cgp), bno + i);
825 cgp->cg_cs.cs_nffree--;
832 byte_swap_cgout(cgp,fs);
852 register struct cg *cgp;
872 cgp = (struct cg *)buf_dataptr(bp);
875 byte_swap_cgin(cgp,fs);
877 if (!cg_chkmagic(cgp) ||
878 (cgp->cg_cs.cs_nbfree == 0 && size == fs->fs_bsize)) {
881 byte_swap_cgout(cgp,fs);
887 cgp->cg_time = tv.tv_sec;
889 bno = ffs_alloccgblk(fs, cgp, bpref);
892 byte_swap_cgout(cgp,fs);
904 if (cgp->cg_frsum[allocsiz] != 0)
911 if (cgp->cg_cs.cs_nbfree == 0) {
914 byte_swap_cgout(cgp,fs);
919 bno = ffs_alloccgblk(fs, cgp, bpref);
922 setbit(cg_blksfree(cgp), bpref + i);
924 cgp->cg_cs.cs_nffree += i;
928 cgp->cg_frsum[i]++;
931 byte_swap_cgout(cgp,fs);
936 bno = ffs_mapsearch(fs, cgp, bpref, allocsiz);
940 byte_swap_cgout(cgp,fs);
946 clrbit(cg_blksfree(cgp), bno + i);
947 cgp->cg_cs.cs_nffree -= frags;
951 cgp->cg_frsum[allocsiz]--;
953 cgp->cg_frsum[allocsiz - frags]++;
956 byte_swap_cgout(cgp,fs);
974 ffs_alloccgblk(fs, cgp, bpref)
976 register struct cg *cgp;
984 if (bpref == 0 || dtog(fs, bpref) != cgp->cg_cgx) {
985 bpref = cgp->cg_rotor;
993 if (ffs_isblock(fs, cg_blksfree(cgp), fragstoblks(fs, bpref))) {
1012 if (cg_blktot(cgp)[cylno] == 0)
1019 cylbp = cg_blks(fs, cgp, cylno);
1041 if (ffs_isblock(fs, cg_blksfree(cgp), bno + i)) {
1059 bno = ffs_mapsearch(fs, cgp, bpref, (int)fs->fs_frag);
1062 cgp->cg_rotor = bno;
1065 ffs_clrblock(fs, cg_blksfree(cgp), (long)blkno);
1066 ffs_clusteracct(fs, cgp, blkno, -1);
1067 cgp->cg_cs.cs_nbfree--;
1069 fs->fs_cs(fs, cgp->cg_cgx).cs_nbfree--;
1071 cg_blks(fs, cgp, cylno)[cbtorpos(fs, bno)]--;
1072 cg_blktot(cgp)[cylno]--;
1074 return (cgp->cg_cgx * fs->fs_fpg + bno);
1092 register struct cg *cgp;
1109 cgp = (struct cg *)buf_dataptr(bp);
1112 byte_swap_cgin(cgp,fs);
1114 if (!cg_chkmagic(cgp)) {
1117 byte_swap_cgout(cgp,fs);
1125 lp = &cg_clustersum(cgp)[len];
1137 lp = &cg_clustersum(cgp)[len - 1];
1144 byte_swap_cgout(cgp,fs);
1163 mapp = &cg_clustersfree(cgp)[bpref / NBBY];
1166 for (run = 0, got = bpref; got < cgp->cg_nclusterblks; got++) {
1181 if (got == cgp->cg_nclusterblks) {
1184 byte_swap_cgout(cgp,fs);
1192 if (!ffs_isblock(fs, cg_blksfree(cgp), got - run + i))
1199 if ((got = ffs_alloccgblk(fs, cgp, bno + i)) != bno + i)
1203 byte_swap_cgout(cgp,fs);
1230 register struct cg *cgp;
1249 cgp = (struct cg *)buf_dataptr(bp);
1252 byte_swap_cgin(cgp,fs);
1254 if (!cg_chkmagic(cgp) || cgp->cg_cs.cs_nifree == 0) {
1257 byte_swap_cgout(cgp,fs);
1264 cgp->cg_time = tv.tv_sec;
1267 if (isclr(cg_inosused(cgp), ipref))
1270 start = cgp->cg_irotor / NBBY;
1271 len = howmany(fs->fs_ipg - cgp->cg_irotor, NBBY);
1272 loc = skpc(0xff, len, &cg_inosused(cgp)[start]);
1276 loc = skpc(0xff, len, &cg_inosused(cgp)[0]);
1279 cg, cgp->cg_irotor, fs->fs_fsmnt);
1285 map = cg_inosused(cgp)[i];
1289 cgp->cg_irotor = ipref;
1297 setbit(cg_inosused(cgp), ipref);
1298 cgp->cg_cs.cs_nifree--;
1303 cgp->cg_cs.cs_ndir++;
1309 byte_swap_cgout(cgp,fs);
1329 register struct cg *cgp;
1358 cgp = (struct cg *)buf_dataptr(bp);
1361 byte_swap_cgin(cgp,fs);
1363 if (!cg_chkmagic(cgp)) {
1366 byte_swap_cgout(cgp,fs);
1372 cgp->cg_time = tv.tv_sec;
1376 if (ffs_isblock(fs, cg_blksfree(cgp), blkno)) {
1381 ffs_setblock(fs, cg_blksfree(cgp), blkno);
1382 ffs_clusteracct(fs, cgp, blkno, 1);
1383 cgp->cg_cs.cs_nbfree++;
1387 cg_blks(fs, cgp, i)[cbtorpos(fs, bno)]++;
1388 cg_blktot(cgp)[i]++;
1394 blk = blkmap(fs, cg_blksfree(cgp), bbase);
1395 ffs_fragacct(fs, blk, cgp->cg_frsum, -1);
1401 if (isset(cg_blksfree(cgp), bno + i)) {
1406 setbit(cg_blksfree(cgp), bno + i);
1408 cgp->cg_cs.cs_nffree += i;
1414 blk = blkmap(fs, cg_blksfree(cgp), bbase);
1415 ffs_fragacct(fs, blk, cgp->cg_frsum, 1);
1420 if (ffs_isblock(fs, cg_blksfree(cgp), blkno)) {
1421 cgp->cg_cs.cs_nffree -= fs->fs_frag;
1424 ffs_clusteracct(fs, cgp, blkno, 1);
1425 cgp->cg_cs.cs_nbfree++;
1429 cg_blks(fs, cgp, i)[cbtorpos(fs, bbase)]++;
1430 cg_blktot(cgp)[i]++;
1436 byte_swap_cgout(cgp,fs);
1452 struct cg *cgp;
1475 cgp = (struct cg *)buf_dataptr(bp);
1478 byte_swap_cgin(cgp,fs);
1480 if (!cg_chkmagic(cgp)) {
1483 byte_swap_cgout(cgp,fs);
1490 free = ffs_isblock(fs, cg_blksfree(cgp), fragstoblks(fs, bno));
1494 if (isset(cg_blksfree(cgp), bno + i))
1501 byte_swap_cgout(cgp,fs);
1517 register struct cg *cgp;
1539 cgp = (struct cg *)buf_dataptr(bp);
1542 byte_swap_cgin(cgp,fs);
1544 if (!cg_chkmagic(cgp)) {
1547 byte_swap_cgout(cgp,fs);
1553 cgp->cg_time = tv.tv_sec;
1555 if (isclr(cg_inosused(cgp), ino)) {
1561 clrbit(cg_inosused(cgp), ino);
1562 if (ino < cgp->cg_irotor)
1563 cgp->cg_irotor = ino;
1564 cgp->cg_cs.cs_nifree++;
1568 cgp->cg_cs.cs_ndir--;
1575 byte_swap_cgout(cgp,fs);
1588 ffs_mapsearch(fs, cgp, bpref, allocsiz)
1590 register struct cg *cgp;
1605 start = cgp->cg_frotor / NBBY;
1607 loc = scanc((u_int)len, (u_char *)&cg_blksfree(cgp)[start],
1613 loc = scanc((u_int)len, (u_char *)&cg_blksfree(cgp)[0],
1624 cgp->cg_frotor = bno;
1630 blk = blkmap(fs, cg_blksfree(cgp), bno);
1652 ffs_clusteracct(struct fs *fs, struct cg *cgp, ufs_daddr_t blkno, int cnt)
1661 freemapp = cg_clustersfree(cgp);
1662 sump = cg_clustersum(cgp);
1675 if (end >= cgp->cg_nclusterblks)
1676 end = cgp->cg_nclusterblks;
1731 fs->fs_maxcluster[cgp->cg_cgx] = i;