The first part of this patch is not yet part of my multipatch at 
    http://www.backplane.com/FreeBSD4/

    This is a tentative fix, but I believe it to be correct.  Until
    yesterday I was testing swap-backed VN with only one swap partition,
    otherwise this would have been found and fixed long ago :-(

    I'm doing a buildworld stress test now to make sure it's been fixed.

                                                -Matt

Index: swap_pager.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/swap_pager.c,v
retrieving revision 1.124
diff -u -r1.124 swap_pager.c
--- swap_pager.c        1999/08/23 23:55:03     1.124
+++ swap_pager.c        1999/08/26 20:20:09
@@ -830,13 +830,19 @@
                        splx(s);
 
                        /*
-                        * Do we have to flush our current collection?
+                        * Do we have to flush our current collection?  Yes if:
+                        *
+                        *      - no swap block at this index
+                        *      - swap block is not contiguous
+                        *      - we cross a physical disk boundry in the
+                        *        stripe.
                         */
 
                        if (
                            nbp && (
                             (blk & SWAPBLK_NONE) ||
-                            nbp->b_blkno + btoc(nbp->b_bcount) != blk
+                            nbp->b_blkno + btoc(nbp->b_bcount) != blk ||
+                            ((nbp->b_blkno ^ blk) & dmmax_mask)
                            )
                        ) {
                                ++cnt.v_swapin;
@@ -857,6 +863,7 @@
                                if (nbp == NULL) {
                                        nbp = getchainbuf(bp, swapdev_vp, 
B_READ|B_ASYNC);
                                        nbp->b_blkno = blk;
+                                       nbp->b_bcount = 0;
                                        nbp->b_data = data;
                                }
                                nbp->b_bcount += PAGE_SIZE;


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to