swapcluster_flush: handle nused==0, which can happen if swapcluster_add failed.

PR/37669 from Andrew Doran.
This commit is contained in:
yamt 2008-02-07 12:24:16 +00:00
parent cb964fe917
commit 7608362b58
1 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_pdaemon.c,v 1.90 2008/01/28 12:22:47 yamt Exp $ */
/* $NetBSD: uvm_pdaemon.c,v 1.91 2008/02/07 12:24:16 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.90 2008/01/28 12:22:47 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.91 2008/02/07 12:24:16 yamt Exp $");
#include "opt_uvmhist.h"
#include "opt_readahead.h"
@ -533,10 +533,12 @@ swapcluster_flush(struct swapcluster *swc, bool now)
* now start the pageout.
*/
if (nused > 0) {
uvmexp.pdpageouts++;
uvm_pageout_start(nused);
error = uvm_swap_put(slot, swc->swc_pages, nused, 0);
KASSERT(error == 0);
}
/*
* zero swslot to indicate that we are