summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2004-02-23 03:15:13 +0000
committeralc <alc@FreeBSD.org>2004-02-23 03:15:13 +0000
commit2d844ba403aa7c79fed3245fdbaf49728f9d0ec0 (patch)
treedfb303ee3130c25cd15dd5d33431890560ac871f /sys
parenta3493bb58a0a07fbb88e7e749c9f4883426f8edc (diff)
downloadFreeBSD-src-2d844ba403aa7c79fed3245fdbaf49728f9d0ec0.zip
FreeBSD-src-2d844ba403aa7c79fed3245fdbaf49728f9d0ec0.tar.gz
- Substitute bdone() and bwait() from vfs_bio.c for
swap_pager_putpages()'s buffer completion code. Note: the only difference between swp_pager_sync_iodone() and bdone(), aside from the locking in the latter, was the unnecessary clearing of B_ASYNC. - Remove an unnecessary pmap_page_protect() from swp_pager_async_iodone(). Reviewed by: tegge
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/swap_pager.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 6fbed93..196085e 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -262,7 +262,6 @@ SYSCTL_INT(_vm, OID_AUTO, dmmax,
CTLFLAG_RD, &dmmax, 0, "Maximum size of a swap block");
static void swp_sizecheck(void);
-static void swp_pager_sync_iodone(struct buf *bp);
static void swp_pager_async_iodone(struct buf *bp);
static int swapongeom(struct thread *, struct vnode *);
static int swaponvp(struct thread *, struct vnode *, u_long);
@@ -1362,7 +1361,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *m, int count,
*
* NOTE: b_blkno is destroyed by the call to swapdev_strategy
*/
- bp->b_iodone = swp_pager_sync_iodone;
+ bp->b_iodone = bdone;
swp_pager_strategy(bp);
/*
@@ -1372,9 +1371,7 @@ swap_pager_putpages(vm_object_t object, vm_page_t *m, int count,
* double-free.
*/
s = splbio();
- while ((bp->b_flags & B_DONE) == 0) {
- tsleep(bp, PVM, "swwrt", 0);
- }
+ bwait(bp, PVM, "swwrt");
for (j = 0; j < n; ++j)
rtvals[i+j] = VM_PAGER_PEND;
/*
@@ -1388,22 +1385,6 @@ swap_pager_putpages(vm_object_t object, vm_page_t *m, int count,
}
/*
- * swap_pager_sync_iodone:
- *
- * Completion routine for synchronous reads and writes from/to swap.
- * We just mark the bp is complete and wake up anyone waiting on it.
- *
- * This routine may not block. This routine is called at splbio() or better.
- */
-static void
-swp_pager_sync_iodone(struct buf *bp)
-{
- bp->b_flags |= B_DONE;
- bp->b_flags &= ~B_ASYNC;
- wakeup(bp);
-}
-
-/*
* swp_pager_async_iodone:
*
* Completion routine for asynchronous reads and writes from/to swap.
@@ -1573,8 +1554,8 @@ swp_pager_async_iodone(struct buf *bp)
pmap_clear_modify(m);
vm_page_undirty(m);
vm_page_io_finish(m);
- if (!vm_page_count_severe() || !vm_page_try_to_cache(m))
- pmap_page_protect(m, VM_PROT_READ);
+ if (vm_page_count_severe())
+ vm_page_try_to_cache(m);
}
}
vm_page_unlock_queues();
OpenPOWER on IntegriCloud