From d9a4f81d1c55cdaebd58184100b1ab8575910a05 Mon Sep 17 00:00:00 2001 From: yamt Date: Wed, 19 Feb 2003 12:22:51 +0000 Subject: [PATCH] wire the pages instead of just dequeue'ing them. advised by Chuck Silvers. --- sys/ufs/lfs/lfs_vfsops.c | 11 ++++++++--- sys/ufs/lfs/lfs_vnops.c | 17 +++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c index 98019576fddb..5a626267fd7e 100644 --- a/sys/ufs/lfs/lfs_vfsops.c +++ b/sys/ufs/lfs/lfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vfsops.c,v 1.93 2003/02/19 12:18:59 yamt Exp $ */ +/* $NetBSD: lfs_vfsops.c,v 1.94 2003/02/19 12:22:51 yamt Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.93 2003/02/19 12:18:59 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.94 2003/02/19 12:22:51 yamt Exp $"); #if defined(_KERNEL_OPT) #include "opt_quota.h" @@ -1804,9 +1804,11 @@ lfs_gop_write(struct vnode *vp, struct vm_page **pgs, int npages, int flags) wakeup(pgs[i]); if (pgs[i]->flags & PG_PAGEOUT) uvmexp.paging--; + if (pgs[i]->flags & PG_DELWRI) { + uvm_pageunwire(pgs[i]); + } pgs[i]->flags &= ~(PG_BUSY|PG_CLEAN|PG_WANTED|PG_DELWRI|PG_PAGEOUT|PG_RELEASED); UVM_PAGE_OWN(pg, NULL); - uvm_pageactivate(pgs[i]); } uvm_page_unbusy(pgs, npages); uvm_unlock_pageq(); @@ -1841,6 +1843,9 @@ lfs_gop_write(struct vnode *vp, struct vm_page **pgs, int npages, int flags) pgs[i]->flags &= ~PG_DELWRI; pgs[i]->flags |= PG_PAGEOUT; uvmexp.paging++; + uvm_lock_pageq(); + uvm_pageunwire(pgs[i]); + uvm_unlock_pageq(); } /* diff --git a/sys/ufs/lfs/lfs_vnops.c b/sys/ufs/lfs/lfs_vnops.c index 6eb70d2a9edf..fa372871d9d6 100644 --- a/sys/ufs/lfs/lfs_vnops.c +++ b/sys/ufs/lfs/lfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vnops.c,v 1.84 2003/02/17 23:48:22 perseant Exp $ */ +/* $NetBSD: lfs_vnops.c,v 1.85 2003/02/19 12:22:51 yamt Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.84 2003/02/17 23:48:22 perseant Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.85 2003/02/19 12:22:51 yamt Exp $"); #include #include @@ -1146,20 +1146,21 @@ check_dirty(struct lfs *fs, struct vnode *vp, if (flags & PGO_FREE) { /* XXXUBC need better way to update */ lfs_subsys_pages += MIN(1, pages_per_block); + /* + * wire the page so that + * pdaemon don't see it again. + */ uvm_lock_pageq(); - UVM_PAGE_OWN(pg, NULL); - uvm_pagedequeue(pg); + uvm_pagewire(pg); + uvm_unlock_pageq(); /* Suspended write flag */ pg->flags |= PG_DELWRI; - uvm_unlock_pageq(); } - } else { - UVM_PAGE_OWN(pg, NULL); } if (pg->flags & PG_WANTED) wakeup(pg); pg->flags &= ~(PG_WANTED|PG_BUSY); - /* UVM_PAGE_OWN(pg, NULL); */ + UVM_PAGE_OWN(pg, NULL); } if (by_list) {