Put an uncovered page between the swap devices, that way we can be sure

to not get any cross-device I/O requests.  (The unallocated first page
protecting BSD labels already gave us this, but that hack may go away
at some point in time).

Remove the check for cross-device I/O requests in swap_pager_strategy.

Move the repeated statistics updating into flushchainbuf().
This commit is contained in:
Poul-Henning Kamp 2003-08-04 08:22:49 +00:00
parent 859c6c7d03
commit 665c0caf03
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118418

View File

@ -1037,23 +1037,9 @@ swap_pager_strategy(vm_object_t object, struct bio *bp)
*
* - no swap block at this index
* - swap block is not contiguous
* - we cross a physical disk boundry in the
* stripe.
*/
if (
nbp && (nbp->b_blkno + btoc(nbp->b_bcount) != blk ||
((nbp->b_blkno ^ blk) & dmmax_mask)
)
) {
if (nbp && (nbp->b_blkno + btoc(nbp->b_bcount) != blk)) {
splx(s);
if (bp->bio_cmd == BIO_READ) {
++cnt.v_swapin;
cnt.v_swappgsin += btoc(nbp->b_bcount);
} else {
++cnt.v_swapout;
cnt.v_swappgsout += btoc(nbp->b_bcount);
nbp->b_dirtyend = nbp->b_bcount;
}
flushchainbuf(nbp);
s = splvm();
nbp = NULL;
@ -1091,14 +1077,6 @@ swap_pager_strategy(vm_object_t object, struct bio *bp)
splx(s);
if (nbp) {
if (nbp->b_iocmd == BIO_READ) {
++cnt.v_swapin;
cnt.v_swappgsin += btoc(nbp->b_bcount);
} else {
++cnt.v_swapout;
cnt.v_swappgsout += btoc(nbp->b_bcount);
nbp->b_dirtyend = nbp->b_bcount;
}
flushchainbuf(nbp);
/* nbp = NULL; */
}
@ -2290,15 +2268,22 @@ static void
flushchainbuf(struct buf *nbp)
{
GIANT_REQUIRED;
if (nbp->b_bcount) {
nbp->b_bufsize = nbp->b_bcount;
if (nbp->b_iocmd == BIO_WRITE)
nbp->b_dirtyend = nbp->b_bcount;
BUF_KERNPROC(nbp);
VOP_STRATEGY(nbp->b_vp, nbp);
} else {
if (nbp->b_bcount == 0) {
bufdone(nbp);
return;
}
if (nbp->b_iocmd == BIO_READ) {
++cnt.v_swapin;
cnt.v_swappgsin += btoc(nbp->b_bcount);
} else {
++cnt.v_swapout;
cnt.v_swappgsout += btoc(nbp->b_bcount);
}
nbp->b_bufsize = nbp->b_bcount;
if (nbp->b_iocmd == BIO_WRITE)
nbp->b_dirtyend = nbp->b_bcount;
BUF_KERNPROC(nbp);
VOP_STRATEGY(nbp->b_vp, nbp);
}
@ -2489,8 +2474,14 @@ swaponvp(td, vp, dev, nblks)
TAILQ_FOREACH(sp, &swtailq, sw_list) {
if (sp->sw_vp == vp)
return (EBUSY);
if (sp->sw_end >= dvbase)
dvbase = sp->sw_end;
if (sp->sw_end >= dvbase) {
/*
* We put one uncovered page between the devices
* in order to definitively prevent any cross-device
* I/O requests
*/
dvbase = sp->sw_end + 1;
}
}
(void) vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);