Lines Matching refs:fs

55 	struct fs *fs;  in cgballoc()  local
58 fs = &disk->d_fs; in cgballoc()
61 for (bno = 0; bno < fs->fs_fpg / fs->fs_frag; bno++) in cgballoc()
62 if (ffs_isblock(fs, blksfree, bno)) in cgballoc()
66 fs->fs_cs(fs, cgp->cg_cgx).cs_nbfree--; in cgballoc()
67 ffs_clrblock(fs, blksfree, (long)bno); in cgballoc()
68 ffs_clusteracct(fs, cgp, bno, -1); in cgballoc()
70 fs->fs_cstotal.cs_nbfree--; in cgballoc()
71 fs->fs_fmod = 1; in cgballoc()
72 return (cgbase(fs, cgp->cg_cgx) + blkstofrags(fs, bno)); in cgballoc()
79 struct fs *fs; in cgbfree() local
84 fs = &disk->d_fs; in cgbfree()
85 cg = dtog(fs, bno); in cgbfree()
89 cgbno = dtogd(fs, bno); in cgbfree()
91 if (size == fs->fs_bsize) { in cgbfree()
92 fragno = fragstoblks(fs, cgbno); in cgbfree()
93 ffs_setblock(fs, blksfree, fragno); in cgbfree()
94 ffs_clusteracct(fs, cgp, fragno, 1); in cgbfree()
96 fs->fs_cstotal.cs_nbfree++; in cgbfree()
97 fs->fs_cs(fs, cg).cs_nbfree++; in cgbfree()
99 bbase = cgbno - fragnum(fs, cgbno); in cgbfree()
103 blk = blkmap(fs, blksfree, bbase); in cgbfree()
104 ffs_fragacct(fs, blk, cgp->cg_frsum, -1); in cgbfree()
108 frags = numfrags(fs, size); in cgbfree()
112 fs->fs_cstotal.cs_nffree += i; in cgbfree()
113 fs->fs_cs(fs, cg).cs_nffree += i; in cgbfree()
117 blk = blkmap(fs, blksfree, bbase); in cgbfree()
118 ffs_fragacct(fs, blk, cgp->cg_frsum, 1); in cgbfree()
122 fragno = fragstoblks(fs, bbase); in cgbfree()
123 if (ffs_isblock(fs, blksfree, fragno)) { in cgbfree()
124 cgp->cg_cs.cs_nffree -= fs->fs_frag; in cgbfree()
125 fs->fs_cstotal.cs_nffree -= fs->fs_frag; in cgbfree()
126 fs->fs_cs(fs, cg).cs_nffree -= fs->fs_frag; in cgbfree()
127 ffs_clusteracct(fs, cgp, fragno, 1); in cgbfree()
129 fs->fs_cstotal.cs_nbfree++; in cgbfree()
130 fs->fs_cs(fs, cg).cs_nbfree++; in cgbfree()
142 struct fs *fs; in cgialloc() local
146 fs = &disk->d_fs; in cgialloc()
149 for (ino = 0; ino < fs->fs_ipg; ino++) in cgialloc()
154 if (fs->fs_magic == FS_UFS2_MAGIC && in cgialloc()
155 ino + INOPB(fs) > cgp->cg_initediblk && in cgialloc()
158 bzero(block, (int)fs->fs_bsize); in cgialloc()
160 for (i = 0; i < INOPB(fs); i++) { in cgialloc()
164 if (bwrite(disk, ino_to_fsba(fs, in cgialloc()
165 cgp->cg_cgx * fs->fs_ipg + cgp->cg_initediblk), in cgialloc()
166 block, fs->fs_bsize)) in cgialloc()
168 cgp->cg_initediblk += INOPB(fs); in cgialloc()
174 fs->fs_cstotal.cs_nifree--; in cgialloc()
175 fs->fs_cs(fs, cgp->cg_cgx).cs_nifree--; in cgialloc()
176 fs->fs_fmod = 1; in cgialloc()
178 return (ino + (cgp->cg_cgx * fs->fs_ipg)); in cgialloc()
221 cgget(int devfd, struct fs *fs, int cg, struct cg *cgp) in cgget() argument
227 if ((cnt = pread(devfd, cgp, fs->fs_cgsize, in cgget()
228 fsbtodb(fs, cgtod(fs, cg)) * (fs->fs_fsize / fsbtodb(fs,1)))) < 0) in cgget()
235 if (cnt != fs->fs_cgsize) { in cgget()
241 if ((fs->fs_metackhash & CK_CYLGRP) != 0) { in cgget()
244 calchash = calculate_crc32c(~0L, (void *)cgp, fs->fs_cgsize); in cgget()
298 cgput(int devfd, struct fs *fs, struct cg *cgp) in cgput() argument
302 if ((fs->fs_metackhash & CK_CYLGRP) != 0) { in cgput()
305 calculate_crc32c(~0L, (void *)cgp, fs->fs_cgsize); in cgput()
308 if ((cnt = pwrite(devfd, cgp, fs->fs_cgsize, in cgput()
309 fsbtodb(fs, cgtod(fs, cgp->cg_cgx)) * in cgput()
310 (fs->fs_fsize / fsbtodb(fs,1)))) < 0) in cgput()
312 if (cnt != fs->fs_cgsize) { in cgput()