print a warning if no swap space found, don't use the first CLBYTES
authorMike Hibler <hibler@ucbvax.Berkeley.EDU>
Fri, 16 Jul 1993 07:24:22 +0000 (23:24 -0800)
committerMike Hibler <hibler@ucbvax.Berkeley.EDU>
Fri, 16 Jul 1993 07:24:22 +0000 (23:24 -0800)
of the first swap device

SCCS-vsn: sys/vm/vm_swap.c 7.30

usr/src/sys/vm/vm_swap.c

index 42a6eb3..5a7b900 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)vm_swap.c   8.1 (Berkeley) %G%
+ *     @(#)vm_swap.c   7.30 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -65,7 +65,9 @@ swapinit()
        if (swdevt[0].sw_vp == NULL &&
            bdevvp(swdevt[0].sw_dev, &swdevt[0].sw_vp))
                panic("swapvp");
        if (swdevt[0].sw_vp == NULL &&
            bdevvp(swdevt[0].sw_dev, &swdevt[0].sw_vp))
                panic("swapvp");
-       if (error = swfree(p, 0)) {
+       if (nswap == 0)
+               printf("WARNING: no swap space found\n");
+       else if (error = swfree(p, 0)) {
                printf("swfree errno %d\n", error);     /* XXX */
                panic("swapinit swfree 0");
        }
                printf("swfree errno %d\n", error);     /* XXX */
                panic("swapinit swfree 0");
        }
@@ -220,12 +222,12 @@ swfree(p, index)
                        blk = dmmax;
                if (vsbase == 0) {
                        /*
                        blk = dmmax;
                if (vsbase == 0) {
                        /*
-                        * First of all chunks.
-                        * Cannot free a zero-index block in a resource
-                        * map so we waste the first block.
+                        * First of all chunks... initialize the swapmap.
+                        * Don't use the first cluster of the device
+                        * in case it starts with a label or boot block.
                         */
                         */
-                       rminit(swapmap, (long)(blk - 1), (long)1,
-                           "swap", nswapmap);
+                       rminit(swapmap, blk - ctod(CLSIZE),
+                           vsbase + ctod(CLSIZE), "swap", nswapmap);
                } else if (dvbase == 0) {
                        /*
                         * Don't use the first cluster of the device
                } else if (dvbase == 0) {
                        /*
                         * Don't use the first cluster of the device