diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-03-20 17:42:35 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-03-20 17:42:35 +0000 |
commit | fb225e7d0ebb8fdf6f94fef9701c6916d628ad1a (patch) | |
tree | 6015d38a4cb5e27d276c2ff47e410a6a65e2ecba | |
parent | 57df2a5ec51b941f5c14e1829ce5e22c31352daf (diff) |
Even more cleanup. This file was a mess.
-rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 74 |
1 files changed, 36 insertions, 38 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index b5b8ca22e92..be061903ba9 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_alloc.c,v 1.24 2001/03/20 17:11:05 art Exp $ */ +/* $OpenBSD: ffs_alloc.c,v 1.25 2001/03/20 17:42:34 art Exp $ */ /* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */ /* @@ -108,7 +108,7 @@ ffs_alloc(ip, lbn, bpref, size, cred, bnp) #ifdef QUOTA int error; #endif - + *bnp = 0; fs = ip->i_fs; #ifdef DIAGNOSTIC @@ -215,7 +215,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) cg = dtog(fs, bprev); if ((bno = ffs_fragextend(ip, cg, (long)bprev, osize, nsize)) != 0) { if (bp->b_blkno != fsbtodb(fs, bno)) - panic("bad blockno"); + panic("ffs_realloccg: bad blockno"); ip->i_ffs_blocks += btodb(nsize - osize); ip->i_flag |= IN_CHANGE | IN_UPDATE; allocbuf(bp, nsize); @@ -232,8 +232,8 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp) switch ((int)fs->fs_optim) { case FS_OPTSPACE: /* - * Allocate an exact sized fragment. Although this makes - * best use of space, we will waste time relocating it if + * Allocate an exact sized fragment. Although this makes + * best use of space, we will waste time relocating it if * the file continues to grow. If the fragmentation is * less than half of the minimum free reserve, we choose * to begin optimizing for time. @@ -317,7 +317,7 @@ nospace: * logical blocks to be made contiguous is given. The allocator attempts * to find a range of sequential blocks starting as close as possible to * an fs_rotdelay offset from the end of the allocation for the logical - * block immediately preceding the current range. If successful, the + * block immediately preceeding the current range. If successful, the * physical block numbers in the buffer pointers and in the inode are * changed to reflect the new allocation. If unsuccessful, the allocation * is left unchanged. The success in doing the reallocation is returned. @@ -460,12 +460,12 @@ ffs_reallocblks(v) if (DOINGSOFTDEP(vp)) { if (sbap == &ip->i_ffs_db[0] && i < ssize) softdep_setup_allocdirect(ip, start_lbn + i, - blkno, *bap, fs->fs_bsize, fs->fs_bsize, - buflist->bs_children[i]); + blkno, *bap, fs->fs_bsize, fs->fs_bsize, + buflist->bs_children[i]); else softdep_setup_allocindir_page(ip, start_lbn + i, - i < ssize ? sbp : ebp, soff + i, blkno, - *bap, buflist->bs_children[i]); + i < ssize ? sbp : ebp, soff + i, blkno, + *bap, buflist->bs_children[i]); } *bap++ = blkno; @@ -474,7 +474,7 @@ ffs_reallocblks(v) * Next we must write out the modified inode and indirect blocks. * For strict correctness, the writes should be synchronous since * the old block values may have been written to disk. In practise - * they are almost never written, but if we are concerned about + * they are almost never written, but if we are concerned about * strict correctness, the `doasyncfree' flag should be set to zero. * * The test on `doasyncfree' should be changed to test a flag @@ -511,9 +511,9 @@ ffs_reallocblks(v) #endif for (blkno = newblk, i = 0; i < len; i++, blkno += fs->fs_frag) { if (!DOINGSOFTDEP(vp)) - ffs_blkfree(ip, + ffs_blkfree(ip, dbtofsb(fs, buflist->bs_children[i]->b_blkno), - fs->fs_bsize); + fs->fs_bsize); buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno); #ifdef DIAGNOSTIC if (!ffs_checkblk(ip, @@ -650,7 +650,7 @@ ffs_dirpref(fs) * Select the desired position for the next block in a file. The file is * logically divided into sections. The first section is composed of the * direct blocks. Each additional section contains fs_maxbpg blocks. - * + * * If no blocks have been allocated in the first section, the policy is to * request a block in the same cylinder group as the inode that describes * the file. If no blocks have been allocated in any other section, the @@ -664,7 +664,7 @@ ffs_dirpref(fs) * indirect block, the information on the previous allocation is unavailable; * here a best guess is made based upon the logical block number being * allocated. - * + * * If a section is already partially allocated, the policy is to * contiguously allocate fs_maxcontig blocks. The end of one of these * contiguous blocks and the beginning of the next is physically separated @@ -794,7 +794,7 @@ ffs_hashalloc(ip, cg, pref, size, allocator) /* * Determine whether a fragment can be extended. * - * Check to see if the necessary fragments are available, and + * Check to see if the necessary fragments are available, and * if they are, allocate them. */ static daddr_t @@ -954,7 +954,7 @@ ffs_alloccg(ip, cg, bpref, size) blkno = cg * fs->fs_fpg + bno; if (DOINGSOFTDEP(ITOV(ip))) softdep_setup_blkmapdep(bp, fs, blkno); - bdwrite(bp); + bdwrite(bp); return ((u_long)blkno); } @@ -1001,7 +1001,7 @@ ffs_alloccgblk(ip, bp, bpref) /* * Block layout information is not available. * Leaving bpref unchanged means we take the - * next available free block following the one + * next available free block following the one * we just allocated. Hopefully this will at * least hit a track cache on drives of unknown * geometry (e.g. SCSI). @@ -1015,7 +1015,7 @@ ffs_alloccgblk(ip, bp, bpref) if (cg_blktot(cgp)[cylno] == 0) goto norot; /* - * check the summary information to see if a block is + * check the summary information to see if a block is * available in the requested cylinder starting at the * requested rotational position and proceeding around. */ @@ -1077,7 +1077,7 @@ gotit: blkno = cgp->cg_cgx * fs->fs_fpg + bno; if (DOINGSOFTDEP(ITOV(ip))) softdep_setup_blkmapdep(bp, fs, blkno); - return (blkno); + return (blkno); } /* @@ -1262,7 +1262,7 @@ ffs_nodealloccg(ip, cg, ipref, mode) panic("ffs_nodealloccg: block not in map"); /* NOTREACHED */ gotit: - if (DOINGSOFTDEP(ITOV(ip))) + if (DOINGSOFTDEP(ITOV(ip))) softdep_setup_inomapdep(bp, ip, cg * fs->fs_ipg + ipref); setbit(cg_inosused(cgp), ipref); @@ -1283,7 +1283,7 @@ gotit: * Free a block or fragment. * * The specified block or fragment is placed back in the - * free map. If a fragment is deallocated, a possible + * free map. If a fragment is deallocated, a possible * block reassembly is checked. */ void @@ -1303,7 +1303,7 @@ ffs_blkfree(ip, bno, size) fragnum(fs, bno) + numfrags(fs, size) > fs->fs_frag) { printf("dev = 0x%x, bsize = %d, size = %ld, fs = %s\n", ip->i_dev, fs->fs_bsize, size, fs->fs_fsmnt); - panic("blkfree: bad size"); + panic("ffs_blkfree: bad size"); } cg = dtog(fs, bno); if ((u_int)bno >= fs->fs_size) { @@ -1329,7 +1329,7 @@ ffs_blkfree(ip, bno, size) if (!ffs_isfreeblock(fs, cg_blksfree(cgp), blkno)) { printf("dev = 0x%x, block = %d, fs = %s\n", ip->i_dev, bno, fs->fs_fsmnt); - panic("blkfree: freeing free block"); + panic("ffs_blkfree: freeing free block"); } ffs_setblock(fs, cg_blksfree(cgp), blkno); ffs_clusteracct(fs, cgp, blkno, 1); @@ -1354,7 +1354,7 @@ ffs_blkfree(ip, bno, size) if (isset(cg_blksfree(cgp), bno + i)) { printf("dev = 0x%x, block = %d, fs = %s\n", ip->i_dev, bno + i, fs->fs_fsmnt); - panic("blkfree: freeing free frag"); + panic("ffs_blkfree: freeing free frag"); } setbit(cg_blksfree(cgp), bno + i); } @@ -1400,7 +1400,6 @@ ffs_vfree(v) int a_mode; } */ *ap = v; - if (DOINGSOFTDEP(ap->a_pvp)) { softdep_freefile(ap->a_pvp, ap->a_ino, ap->a_mode); return (0); @@ -1415,11 +1414,11 @@ ffs_vfree(v) */ int ffs_freefile(ap) - struct vop_vfree_args /* { - struct vnode *a_pvp; - ino_t a_ino; - int a_mode; - } */ *ap; + struct vop_vfree_args /* { + struct vnode *a_pvp; + ino_t a_ino; + int a_mode; + } */ *ap; { register struct fs *fs; register struct cg *cgp; @@ -1431,7 +1430,7 @@ ffs_freefile(ap) pip = VTOI(ap->a_pvp); fs = pip->i_fs; if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg) - panic("ifree: range: dev = 0x%x, ino = %d, fs = %s", + panic("ffs_freefile: range: dev = 0x%x, ino = %d, fs = %s", pip->i_dev, ino, fs->fs_fsmnt); cg = ino_to_cg(fs, ino); error = bread(pip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), @@ -1451,7 +1450,7 @@ ffs_freefile(ap) printf("dev = 0x%x, ino = %d, fs = %s\n", pip->i_dev, ino, fs->fs_fsmnt); if (fs->fs_ronly == 0) - panic("ifree: freeing free inode"); + panic("ffs_freefile: freeing free inode"); } clrbit(cg_inosused(cgp), ino); if (ino < cgp->cg_irotor) @@ -1489,10 +1488,10 @@ ffs_checkblk(ip, bno, size) if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) { printf("bsize = %d, size = %ld, fs = %s\n", fs->fs_bsize, size, fs->fs_fsmnt); - panic("checkblk: bad size"); + panic("ffs_checkblk: bad size"); } if ((u_int)bno >= fs->fs_size) - panic("checkblk: bad block %d", bno); + panic("ffs_checkblk: bad block %d", bno); error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, dtog(fs, bno))), (int)fs->fs_cgsize, NOCRED, &bp); if (error) { @@ -1515,7 +1514,7 @@ ffs_checkblk(ip, bno, size) if (isset(cg_blksfree(cgp), bno + i)) free++; if (free != 0 && free != frags) - panic("checkblk: partially free fragment"); + panic("ffs_checkblk: partially free fragment"); } brelse(bp); return (!free); @@ -1682,7 +1681,7 @@ ffs_clusteracct(fs, cgp, blkno, cnt) /* * Fserr prints the name of a file system with an error diagnostic. - * + * * The form of the error message is: * fs: error message */ @@ -1695,4 +1694,3 @@ ffs_fserr(fs, uid, cp) log(LOG_ERR, "uid %d on %s: %s\n", uid, fs->fs_fsmnt, cp); } - |