Page MenuHomeFreeBSD

D21191.id60598.diff
No OneTemporary

D21191.id60598.diff

Index: sbin/swapon/swapon.c
===================================================================
--- sbin/swapon/swapon.c
+++ sbin/swapon/swapon.c
@@ -45,6 +45,7 @@
#include <sys/param.h>
#include <sys/disk.h>
+#include <sys/disklabel.h>
#include <sys/mdioctl.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
@@ -761,8 +762,8 @@
} else
errx(1, "%s has an invalid file type", name);
/* Trim the device. */
- ioarg[0] = 0;
- ioarg[1] = sz;
+ ioarg[0] = BBSIZE;
+ ioarg[1] = sz - BBSIZE;
if (ioctl(fd, DIOCGDELETE, ioarg) != 0)
warn("ioctl(DIOCGDELETE)");
Index: sys/vm/swap_pager.c
===================================================================
--- sys/vm/swap_pager.c
+++ sys/vm/swap_pager.c
@@ -79,6 +79,7 @@
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/disk.h>
+#include <sys/disklabel.h>
#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/lock.h>
@@ -2298,10 +2299,11 @@
sp->sw_blist = blist_create(nblks, M_WAITOK);
/*
- * Do not free the first two block in order to avoid overwriting
+ * Do not free the first blocks in order to avoid overwriting
* any bsd label at the front of the partition
*/
- blist_free(sp->sw_blist, 2, nblks - 2);
+ blist_free(sp->sw_blist, BBSIZE / PAGE_SIZE,
+ nblks - BBSIZE / PAGE_SIZE);
dvbase = 0;
mtx_lock(&sw_dev_mtx);
@@ -2319,7 +2321,7 @@
sp->sw_end = dvbase + nblks;
TAILQ_INSERT_TAIL(&swtailq, sp, sw_list);
nswapdev++;
- swap_pager_avail += nblks - 2;
+ swap_pager_avail += nblks - BBSIZE / PAGE_SIZE;
swap_total += nblks;
swapon_check_swzone();
swp_sizecheck();

File Metadata

Mime Type
text/plain
Expires
Mon, Sep 7, 7:11 AM (20 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38456090
Default Alt Text
D21191.id60598.diff (1 KB)

Event Timeline