--- Net2/vm/swap_pager.c 2018/04/24 18:03:57 1.1.1.1 +++ Net2/vm/swap_pager.c 2018/04/24 18:04:44 1.1.1.2 @@ -39,6 +39,7 @@ * * @(#)swap_pager.c 7.4 (Berkeley) 5/7/91 */ +static char rcsid[] = "$Header: /var/lib/cvsd/net2/Net2/vm/swap_pager.c,v 1.1.1.2 2018/04/24 18:04:44 root Exp $"; /* * Quick hack to page to dedicated partition(s). @@ -53,12 +54,12 @@ #include "param.h" #include "proc.h" #include "buf.h" -#include "map.h" #include "systm.h" #include "specdev.h" #include "vnode.h" #include "malloc.h" #include "queue.h" +#include "rlist.h" #include "vm_param.h" #include "queue.h" @@ -74,7 +75,7 @@ #define MAXDADDRS 64 /* max # of disk addrs for fixed allocations */ #ifdef DEBUG -int swpagerdebug = 0x100; +int swpagerdebug = 0 /*0x100*/; #define SDB_FOLLOW 0x001 #define SDB_INIT 0x002 #define SDB_ALLOC 0x004 @@ -345,6 +346,7 @@ swap_pager_dealloc(pager) /* * Free left over swap blocks */ + s = splbio(); for (i = 0, bp = swp->sw_blocks; i < swp->sw_nblocks; i++, bp++) if (bp->swb_block) { #ifdef DEBUG @@ -352,8 +354,10 @@ swap_pager_dealloc(pager) printf("swpg_dealloc: blk %x\n", bp->swb_block); #endif - rmfree(swapmap, swp->sw_bsize, bp->swb_block); + rlist_free(&swapmap, (unsigned)bp->swb_block, + (unsigned)bp->swb_block + swp->sw_bsize - 1); } + splx(s); /* * Free swap management resources */ @@ -515,6 +519,7 @@ swap_pager_io(swp, m, flags) #endif return(VM_PAGER_FAIL); } + s = splbio(); swb = &swp->sw_blocks[ix]; off = off % dbtob(swp->sw_bsize); if (flags & B_READ) { @@ -529,18 +534,26 @@ swap_pager_io(swp, m, flags) m->offset, m->object->paging_offset); #endif /* XXX: should we zero page here?? */ + splx(s); return(VM_PAGER_FAIL); } } else if (swb->swb_block == 0) { +#ifdef old swb->swb_block = rmalloc(swapmap, swp->sw_bsize); if (swb->swb_block == 0) { +#else + if (!rlist_alloc(&swapmap, (unsigned)swp->sw_bsize, + (unsigned *)&swb->swb_block)) { +#endif #ifdef DEBUG if (swpagerdebug & SDB_FAIL) printf("swpg_io: rmalloc of %x failed\n", swp->sw_bsize); #endif + splx(s); return(VM_PAGER_FAIL); } + splx(s); #ifdef DEBUG if (swpagerdebug & (SDB_FULL|SDB_ALLOCBLK)) printf("swpg_io: %x alloc blk %x at ix %x\n", @@ -853,8 +866,10 @@ swap_pager_iodone(bp) spc->spc_flags &= ~SPC_BUSY; spc->spc_flags |= SPC_DONE; - if (bp->b_flags & B_ERROR) + if (bp->b_flags & B_ERROR) { spc->spc_flags |= SPC_ERROR; +printf("error %d blkno %d sz %d ", bp->b_error, bp->b_blkno, bp->b_bcount); + } spc->spc_bp = NULL; blk = bp->b_blkno;