Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133556693
D21191.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D21191.id.diff
View Options
Index: head/sbin/swapon/swapon.8
===================================================================
--- head/sbin/swapon/swapon.8
+++ head/sbin/swapon/swapon.8
@@ -90,7 +90,17 @@
.Fl E
option causes each of following devices to receive a
.Dv BIO_DELETE
-command to mark all blocks as unused.
+command.
+This command marks the device's blocks as unused, except those that
+might store a disk label.
+This marking can erase a crash dump.
+To delay
+.Nm swapon
+for a device until after
+.Nm savecore
+has copied the crash dump to another location, use the
+.Dq late
+option.
.Pp
The
.Nm swapoff
Index: head/sbin/swapon/swapon.c
===================================================================
--- head/sbin/swapon/swapon.c
+++ head/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: head/share/man/man5/fstab.5
===================================================================
--- head/share/man/man5/fstab.5
+++ head/share/man/man5/fstab.5
@@ -246,8 +246,17 @@
.Dq trimonce
triggers the delivery of a
.Dv BIO_DELETE
-command to the device to mark
-all blocks as unused.
+command to the device.
+This command marks the device's blocks as unused, except those that
+might store a disk label.
+This marking can erase a crash dump.
+To delay
+.Nm swapon
+for a device until after
+.Nm savecore
+has copied the crash dump to another location, use the
+.Dq late
+option.
For vnode-backed swap spaces,
.Dq file
is supported in the
Index: head/sys/vm/swap_pager.c
===================================================================
--- head/sys/vm/swap_pager.c
+++ head/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, howmany(BBSIZE, PAGE_SIZE),
+ nblks - howmany(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 - howmany(BBSIZE, PAGE_SIZE);
swap_total += nblks;
swapon_check_swzone();
swp_sizecheck();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Oct 27, 3:38 PM (53 s ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24144378
Default Alt Text
D21191.id.diff (2 KB)
Attached To
Mode
D21191: Don't trim bsd_label
Attached
Detach File
Event Timeline
Log In to Comment