-/* $OpenBSD: uvm_swap.c,v 1.131 2014/11/18 02:37:31 tedu Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.132 2014/12/23 04:47:30 tedu Exp $ */
/* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */
/*
struct pool vndxfer_pool;
struct pool vndbuf_pool;
-#define getvndxfer(vnx) do { \
- int s = splbio(); \
- vnx = pool_get(&vndxfer_pool, PR_WAITOK); \
- splx(s); \
-} while (0)
-
-#define putvndxfer(vnx) { \
- pool_put(&vndxfer_pool, (void *)(vnx)); \
-}
-
-#define getvndbuf(vbp) do { \
- int s = splbio(); \
- vbp = pool_get(&vndbuf_pool, PR_WAITOK); \
- splx(s); \
-} while (0)
-
-#define putvndbuf(vbp) { \
- pool_put(&vndbuf_pool, (void *)(vbp)); \
-}
/*
* local variables
/* allocate pools for structures used for swapping to files. */
pool_init(&vndxfer_pool, sizeof(struct vndxfer), 0, 0, 0, "swp vnx",
NULL);
+ pool_setipl(&vndxfer_pool, IPL_BIO);
pool_init(&vndbuf_pool, sizeof(struct vndbuf), 0, 0, 0, "swp vnd",
NULL);
+ pool_setipl(&vndbuf_pool, IPL_BIO);
/* Setup the initial swap partition */
swapmount();
* allocate a vndxfer head for this transfer and point it to
* our buffer.
*/
- getvndxfer(vnx);
+ vnx = pool_get(&vndxfer_pool, PR_WAITOK);
vnx->vx_flags = VX_BUSY;
vnx->vx_error = 0;
vnx->vx_pending = 0;
* at the front of the nbp structure so that you can
* cast pointers between the two structure easily.
*/
- getvndbuf(nbp);
+ nbp = pool_get(&vndbuf_pool, PR_WAITOK);
nbp->vb_buf.b_flags = bp->b_flags | B_CALL;
nbp->vb_buf.b_bcount = sz;
nbp->vb_buf.b_bufsize = sz;
s = splbio();
if (vnx->vx_error != 0) {
- putvndbuf(nbp);
+ pool_put(&vndbuf_pool, nbp);
goto out;
}
vnx->vx_pending++;
bp->b_error = vnx->vx_error;
bp->b_flags |= B_ERROR;
}
- putvndxfer(vnx);
+ pool_put(&vndxfer_pool, vnx);
biodone(bp);
}
splx(s);
}
/* kill vbp structure */
- putvndbuf(vbp);
+ pool_put(&vndbuf_pool, vbp);
/*
* wrap up this transaction if it has run to completion or, in
pbp->b_flags |= B_ERROR;
pbp->b_error = vnx->vx_error;
if ((vnx->vx_flags & VX_BUSY) == 0 && vnx->vx_pending == 0) {
- putvndxfer(vnx);
+ pool_put(&vndxfer_pool, vnx);
biodone(pbp);
}
} else if (pbp->b_resid == 0) {
KASSERT(vnx->vx_pending == 0);
if ((vnx->vx_flags & VX_BUSY) == 0) {
- putvndxfer(vnx);
+ pool_put(&vndxfer_pool, vnx);
biodone(pbp);
}
}
* now allocate a buf for the i/o.
* [make sure we don't put the pagedaemon to sleep...]
*/
- s = splbio();
pflag = (async || curproc == uvm.pagedaemon_proc) ? PR_NOWAIT :
PR_WAITOK;
- bp = pool_get(&bufpool, pflag);
- splx(s);
+ bp = pool_get(&bufpool, pflag | PR_ZERO);
/*
* if we failed to get a swapbuf, return "try again"