Fix vfs_bio_awrite usage, and correct vtruncbuf usage.

This commit is contained in:
John Dyson 1998-03-19 22:49:44 +00:00
parent 0b52b1b3ee
commit 34f72be5af
2 changed files with 17 additions and 11 deletions

View File

@ -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;

View File

@ -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