Removed third arg (vmio) to allocbuf() that was added with the original
merged cache changes, and figure it out based on the B_VMIO buffer flag. Fixes a problem where delayed write VMIO buffers would sometimes get recopied into kernel-alloced memory. Submitted by: John Dyson
This commit is contained in:
parent
5c7b628b09
commit
8b2672e499
@ -18,7 +18,7 @@
|
||||
* 5. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: vfs_bio.c,v 1.35 1995/03/07 19:53:27 davidg Exp $
|
||||
* $Id: vfs_bio.c,v 1.36 1995/03/16 18:12:47 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -439,12 +439,10 @@ brelse(struct buf * bp)
|
||||
vm_page_protect(m, VM_PROT_NONE);
|
||||
vm_page_free(m);
|
||||
}
|
||||
#if 1
|
||||
else if ((m->dirty & m->valid) == 0 &&
|
||||
(m->flags & PG_REFERENCED) == 0 &&
|
||||
!pmap_is_referenced(VM_PAGE_TO_PHYS(m)))
|
||||
vm_page_cache(m);
|
||||
#endif
|
||||
else if ((m->flags & PG_ACTIVE) == 0) {
|
||||
vm_page_activate(m);
|
||||
m->act_count = 0;
|
||||
@ -628,7 +626,7 @@ getnewbuf(int slpflag, int slptimeo, int doingvmio)
|
||||
LIST_INSERT_HEAD(&invalhash, bp, b_hash);
|
||||
splx(s);
|
||||
if (bp->b_bufsize) {
|
||||
allocbuf(bp, 0, 0);
|
||||
allocbuf(bp, 0);
|
||||
}
|
||||
bp->b_flags = B_BUSY;
|
||||
bp->b_dev = NODEV;
|
||||
@ -809,7 +807,7 @@ getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo)
|
||||
}
|
||||
splx(s);
|
||||
|
||||
if (!allocbuf(bp, size, 1)) {
|
||||
if (!allocbuf(bp, size)) {
|
||||
s = splbio();
|
||||
goto loop;
|
||||
}
|
||||
@ -826,7 +824,7 @@ geteblk(int size)
|
||||
struct buf *bp;
|
||||
|
||||
while ((bp = getnewbuf(0, 0, 0)) == 0);
|
||||
allocbuf(bp, size, 0);
|
||||
allocbuf(bp, size);
|
||||
bp->b_flags |= B_INVAL;
|
||||
return (bp);
|
||||
}
|
||||
@ -843,14 +841,15 @@ geteblk(int size)
|
||||
* destroying information (unless, of course the buffer is shrinking).
|
||||
*/
|
||||
int
|
||||
allocbuf(struct buf * bp, int size, int vmio)
|
||||
allocbuf(struct buf * bp, int size)
|
||||
{
|
||||
|
||||
int s;
|
||||
int newbsize, mbsize;
|
||||
int i;
|
||||
int vmio = (bp->b_flags & B_VMIO) != 0;
|
||||
|
||||
if ((bp->b_flags & B_VMIO) == 0) {
|
||||
if (!vmio) {
|
||||
/*
|
||||
* Just get anonymous memory from the kernel
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)buf.h 8.7 (Berkeley) 1/21/94
|
||||
* $Id: buf.h,v 1.13 1995/03/16 18:16:12 bde Exp $
|
||||
* $Id: buf.h,v 1.14 1995/03/25 08:55:02 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_BUF_H_
|
||||
@ -220,7 +220,7 @@ struct buf *incore __P((struct vnode *, daddr_t));
|
||||
int inmem __P((struct vnode *, daddr_t));
|
||||
struct buf *getblk __P((struct vnode *, daddr_t, int, int, int));
|
||||
struct buf *geteblk __P((int));
|
||||
int allocbuf __P((struct buf *, int, int));
|
||||
int allocbuf __P((struct buf *, int));
|
||||
int biowait __P((struct buf *));
|
||||
void biodone __P((struct buf *));
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)buf.h 8.7 (Berkeley) 1/21/94
|
||||
* $Id: buf.h,v 1.13 1995/03/16 18:16:12 bde Exp $
|
||||
* $Id: buf.h,v 1.14 1995/03/25 08:55:02 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_BUF_H_
|
||||
@ -220,7 +220,7 @@ struct buf *incore __P((struct vnode *, daddr_t));
|
||||
int inmem __P((struct vnode *, daddr_t));
|
||||
struct buf *getblk __P((struct vnode *, daddr_t, int, int, int));
|
||||
struct buf *geteblk __P((int));
|
||||
int allocbuf __P((struct buf *, int, int));
|
||||
int allocbuf __P((struct buf *, int));
|
||||
int biowait __P((struct buf *));
|
||||
void biodone __P((struct buf *));
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ffs_alloc.c 8.8 (Berkeley) 2/21/94
|
||||
* $Id: ffs_alloc.c,v 1.10 1995/03/10 22:11:50 davidg Exp $
|
||||
* $Id: ffs_alloc.c,v 1.11 1995/03/19 14:29:11 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -222,7 +222,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
|
||||
panic("bad blockno");
|
||||
ip->i_blocks += btodb(nsize - osize);
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
allocbuf(bp, nsize, 0);
|
||||
allocbuf(bp, nsize);
|
||||
bp->b_flags |= B_DONE;
|
||||
bzero((char *)bp->b_data + osize, (u_int)nsize - osize);
|
||||
*bpp = bp;
|
||||
@ -286,7 +286,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
|
||||
(long)(request - nsize));
|
||||
ip->i_blocks += btodb(nsize - osize);
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
allocbuf(bp, nsize, 0);
|
||||
allocbuf(bp, nsize);
|
||||
bp->b_flags |= B_DONE;
|
||||
bzero((char *)bp->b_data + osize, (u_int)nsize - osize);
|
||||
*bpp = bp;
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ffs_inode.c 8.5 (Berkeley) 12/30/93
|
||||
* $Id: ffs_inode.c,v 1.11 1995/01/09 16:05:18 davidg Exp $
|
||||
* $Id: ffs_inode.c,v 1.12 1995/03/04 03:24:42 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -249,7 +249,7 @@ ffs_truncate(ap)
|
||||
oip->i_size = length;
|
||||
size = blksize(fs, oip, lbn);
|
||||
bzero((char *)bp->b_data + offset, (u_int)(size - offset));
|
||||
allocbuf(bp, size, 0);
|
||||
allocbuf(bp, size);
|
||||
if (aflags & IO_SYNC)
|
||||
bwrite(bp);
|
||||
else
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)lfs_inode.c 8.5 (Berkeley) 12/30/93
|
||||
* $Id: lfs_inode.c,v 1.6 1995/01/09 16:05:21 davidg Exp $
|
||||
* $Id: lfs_inode.c,v 1.7 1995/03/19 14:29:17 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -235,7 +235,7 @@ lfs_truncate(ap)
|
||||
ip->i_size = length;
|
||||
size = blksize(fs);
|
||||
bzero((char *)bp->b_data + offset, (u_int)(size - offset));
|
||||
allocbuf(bp, size, 0);
|
||||
allocbuf(bp, size);
|
||||
if (e1 = VOP_BWRITE(bp))
|
||||
return (e1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user