diff options
| author | Doug Moore <dougm@FreeBSD.org> | 2019-09-15 20:13:46 +0000 |
|---|---|---|
| committer | Doug Moore <dougm@FreeBSD.org> | 2019-09-15 20:13:46 +0000 |
| commit | 201ff19e59b2f9c6dd486a629f03704d1aa93f23 (patch) | |
| tree | f5acefb76f7c633a376688680c8def7dcb6fdda2 /sys | |
| parent | 746cae52fed43f00c2cb427e4f636db18a8b38e6 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/vm/swap_pager.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 01b6a23957ea..f0ee3d75de62 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bio.h> #include <sys/buf.h> #include <sys/disk.h> +#include <sys/disklabel.h> #include <sys/fcntl.h> #include <sys/mount.h> #include <sys/namei.h> @@ -2240,10 +2241,11 @@ swaponsomething(struct vnode *vp, void *id, u_long nblks, 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, howmany(BBSIZE, PAGE_SIZE), + nblks - howmany(BBSIZE, PAGE_SIZE)); dvbase = 0; mtx_lock(&sw_dev_mtx); @@ -2261,7 +2263,7 @@ swaponsomething(struct vnode *vp, void *id, u_long nblks, sp->sw_end = dvbase + nblks; TAILQ_INSERT_TAIL(&swtailq, sp, sw_list); nswapdev++; - swap_pager_avail += nblks - 2; + swap_pager_avail += nblks - howmany(BBSIZE, PAGE_SIZE); swap_total += nblks; swapon_check_swzone(); swp_sizecheck(); |
