From: David Rhodus Date: Tue, 24 Aug 2004 14:01:57 +0000 (+0000) Subject: Add a few notes. X-Git-Tag: v2.0.1~10444 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/0f1737b390edc0d7072934117d96488880271380 Add a few notes. --- diff --git a/sys/vfs/ufs/ffs_balloc.c b/sys/vfs/ufs/ffs_balloc.c index 324977c84e..1eaea679bf 100644 --- a/sys/vfs/ufs/ffs_balloc.c +++ b/sys/vfs/ufs/ffs_balloc.c @@ -32,7 +32,7 @@ * * @(#)ffs_balloc.c 8.8 (Berkeley) 6/16/95 * $FreeBSD: src/sys/ufs/ffs/ffs_balloc.c,v 1.26.2.1 2002/10/10 19:48:20 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_balloc.c,v 1.8 2004/07/18 19:43:48 drhodus Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_balloc.c,v 1.9 2004/08/24 14:01:57 drhodus Exp $ */ #include @@ -97,8 +97,21 @@ ffs_balloc(struct vop_balloc_args *ap) */ nb = lblkno(fs, ip->i_size); if (nb < NDADDR && nb < lbn) { + /* + * The filesize prior to this write can fit in direct + * blocks (ex. gragmentation is possibly done) + * we are now extending the file write beyond + * the block which has end of the file prior to this write. osize = blksize(fs, ip, nb); + /* + * osize gives disk allocated size in the last block. It is + * either in fragments or a file system block size. + */ if (osize < fs->fs_bsize && osize > 0) { + /* A few fragments are already allocated, since the + * current extends beyond this block allocated the + * complete block as fragments are on in last block. + */ error = ffs_realloccg(ip, nb, ffs_blkpref(ip, nb, (int)nb, &ip->i_db[0]), osize, (int)fs->fs_bsize, cred, &bp); @@ -108,6 +121,7 @@ ffs_balloc(struct vop_balloc_args *ap) softdep_setup_allocdirect(ip, nb, dbtofsb(fs, bp->b_blkno), ip->i_db[nb], fs->fs_bsize, osize, bp); + /* adjust the inode size, we just grew */ ip->i_size = smalllblktosize(fs, nb + 1); ip->i_db[nb] = dbtofsb(fs, bp->b_blkno); ip->i_flag |= IN_CHANGE | IN_UPDATE; @@ -115,6 +129,7 @@ ffs_balloc(struct vop_balloc_args *ap) bwrite(bp); else bawrite(bp); + /* bp is already released here */ } } /* diff --git a/sys/vfs/ufs/ffs_inode.c b/sys/vfs/ufs/ffs_inode.c index 8219e0c5e6..339fb697ad 100644 --- a/sys/vfs/ufs/ffs_inode.c +++ b/sys/vfs/ufs/ffs_inode.c @@ -32,7 +32,7 @@ * * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95 * $FreeBSD: src/sys/ufs/ffs/ffs_inode.c,v 1.56.2.5 2002/02/05 18:35:03 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_inode.c,v 1.11 2004/07/18 19:43:48 drhodus Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_inode.c,v 1.12 2004/08/24 14:01:57 drhodus Exp $ */ #include "opt_quota.h" @@ -280,6 +280,7 @@ ffs_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred, lastiblock[DOUBLE] = lastiblock[SINGLE] - NINDIR(fs); lastiblock[TRIPLE] = lastiblock[DOUBLE] - NINDIR(fs) * NINDIR(fs); nblocks = btodb(fs->fs_bsize); + /* * Update file and block pointers on disk before we start freeing * blocks. If we crash before free'ing blocks below, the blocks diff --git a/sys/vfs/ufs/ffs_vfsops.c b/sys/vfs/ufs/ffs_vfsops.c index 98d533292e..2ca7b8c44e 100644 --- a/sys/vfs/ufs/ffs_vfsops.c +++ b/sys/vfs/ufs/ffs_vfsops.c @@ -32,7 +32,7 @@ * * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 * $FreeBSD: src/sys/ufs/ffs/ffs_vfsops.c,v 1.117.2.10 2002/06/23 22:34:52 iedowse Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_vfsops.c,v 1.22 2004/08/19 14:42:46 drhodus Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_vfsops.c,v 1.23 2004/08/24 14:01:57 drhodus Exp $ */ #include "opt_quota.h" @@ -925,6 +925,7 @@ ffs_flushfiles(struct mount *mp, int flags, struct thread *td) error = vflush(mp, 0, SKIPSYSTEM|flags); if (error) return (error); + /* Find out how many quota files we have open. */ for (i = 0; i < MAXQUOTAS; i++) { if (ump->um_quotas[i] == NULLVP) continue; @@ -1053,6 +1054,9 @@ ffs_sync_scan1(struct mount *mp, struct vnode *vp, void *data) * call unless there's a good chance that we have work to do. */ ip = VTOI(vp); + /* Restart out whole search if this guy is locked + * or is being reclaimed. + */ if (vp->v_type == VNON || ((ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 && TAILQ_EMPTY(&vp->v_dirtyblkhd))) { @@ -1184,6 +1188,7 @@ restart: ip->i_dquot[i] = NODQUOT; } #endif + /* * Put it onto its hash chain and lock it so that other requests for * this inode will block if they arrive while we are sleeping waiting diff --git a/sys/vfs/ufs/ffs_vnops.c b/sys/vfs/ufs/ffs_vnops.c index 28006a29df..99099cb0da 100644 --- a/sys/vfs/ufs/ffs_vnops.c +++ b/sys/vfs/ufs/ffs_vnops.c @@ -32,7 +32,7 @@ * * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95 * $FreeBSD: src/sys/ufs/ffs/ffs_vnops.c,v 1.64 2000/01/10 12:04:25 phk Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_vnops.c,v 1.10 2004/08/17 18:57:36 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_vnops.c,v 1.11 2004/08/24 14:01:57 drhodus Exp $ */ #include @@ -224,7 +224,7 @@ loop: if (wait) { while (vp->v_numoutput) { vp->v_flag |= VBWAIT; - (void) tsleep((caddr_t)&vp->v_numoutput, 0, "ffsfsn", 0); + (void)tsleep((caddr_t)&vp->v_numoutput, 0, "ffsfsn", 0); } /*