diff options
author | dyson <dyson@FreeBSD.org> | 1998-03-19 22:49:44 +0000 |
---|---|---|
committer | dyson <dyson@FreeBSD.org> | 1998-03-19 22:49:44 +0000 |
commit | aa402e9a1a41ec34147c5fa984b24bd2d6202a58 (patch) | |
tree | dec4a57990b5ae3bcb5e8d281ef03059ada9d2ec /sys/ufs | |
parent | 9c4b0fed795de7308bd3b61a4752a5711e21cf8f (diff) | |
download | FreeBSD-src-aa402e9a1a41ec34147c5fa984b24bd2d6202a58.zip FreeBSD-src-aa402e9a1a41ec34147c5fa984b24bd2d6202a58.tar.gz |
Fix vfs_bio_awrite usage, and correct vtruncbuf usage.
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 13 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 15 |
2 files changed, 17 insertions, 11 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index f21fc0f..02ce546 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95 - * $Id: ffs_inode.c,v 1.36 1998/03/08 09:58:55 julian Exp $ + * $Id: ffs_inode.c,v 1.37 1998/03/16 01:55:43 dyson Exp $ */ #include "opt_quota.h" @@ -314,9 +314,8 @@ ffs_truncate(vp, length, flags, cred, p) for (i = NDADDR - 1; i > lastblock; i--) oip->i_db[i] = 0; oip->i_flag |= IN_CHANGE | IN_UPDATE; - error = UFS_UPDATE(ovp, &tv, &tv, ((length > 0) ? 0 : 1)); - if (error) - allerror = error; + allerror = UFS_UPDATE(ovp, &tv, &tv, ((length > 0) ? 0 : 1)); + /* * Having written the new inode to disk, save its new configuration * and put back the old block pointers long enough to process them. @@ -326,7 +325,10 @@ ffs_truncate(vp, length, flags, cred, p) bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof newblks); bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof oldblks); oip->i_size = osize; - allerror = vtruncbuf(ovp, cred, p, length, fs->fs_bsize); + + error = vtruncbuf(ovp, cred, p, length, fs->fs_bsize); + if (error && (allerror == 0)) + allerror = error; /* * Indirect blocks first. @@ -414,6 +416,7 @@ done: */ oip->i_size = length; oip->i_blocks -= blocksreleased; + if (oip->i_blocks < 0) /* sanity */ oip->i_blocks = 0; oip->i_flag |= IN_CHANGE; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 44db8f4..8e2c218 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95 - * $Id: ffs_vnops.c,v 1.43 1998/02/26 06:39:38 msmith Exp $ + * $Id: ffs_vnops.c,v 1.44 1998/03/08 09:59:10 julian Exp $ */ #include <sys/param.h> @@ -166,9 +166,6 @@ loop2: */ if (((bp->b_vp != vp) || (ap->a_waitfor == MNT_WAIT)) || ((vp->v_type != VREG) && (vp->v_type != VBLK))) { - bremfree(bp); - bp->b_flags |= B_BUSY; - splx(s); /* * Wait for I/O associated with indirect blocks to @@ -177,12 +174,18 @@ loop2: */ if ((bp->b_vp == vp) || (ap->a_waitfor != MNT_WAIT)) { if (bp->b_flags & B_CLUSTEROK) { - bdwrite(bp); (void) vfs_bio_awrite(bp); + splx(s); } else { + bremfree(bp); + bp->b_flags |= B_BUSY; + splx(s); (void) bawrite(bp); } } else { + bremfree(bp); + bp->b_flags |= B_BUSY; + splx(s); (void) bwrite(bp); } } else if ((vp->v_type == VREG) && (bp->b_lblkno >= lbn)) { @@ -214,7 +217,7 @@ loop2: s = splbio(); while (vp->v_numoutput) { vp->v_flag |= VBWAIT; - (void) tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "ffsfsn", 0); + (void) tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 4, "ffsfsn", 0); } /* * Ensure that any filesystem metatdata associated |