From c2301380b4d61921971f89661088d1dab7c70ccd Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Sun, 24 Oct 2010 17:32:47 -0700 Subject: swapon: add "discard" support In kernel 2.6.36 (and in stable kernel 2.6.35.5) I made a tiny change to the swapon(const char *path, int swapflags) system call interface: kernel commit 3399446632739fcd05fd8b272b476a69c6e6d14a swap: discard while swapping only if SWAP_FLAG_DISCARD As things stand at present, we could just remove the swap discard support; but since several filesystems (including ext4 and btrfs and fat) are offering a "discard" mount option, I thought swap should take the same course, and offer a "--discard" or "-d" option to swapon(8). [kzak@redhat.com: - update swapon.8 man page - use for -d the same logic as for -p] Signed-off-by: Hugh Dickins Signed-off-by: Karel Zak --- mount/swapon.8 | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mount/swapon.8') diff --git a/mount/swapon.8 b/mount/swapon.8 index 595198d51..e35c6e5f5 100644 --- a/mount/swapon.8 +++ b/mount/swapon.8 @@ -54,6 +54,7 @@ Enable/disable: .br .in +5 .B swapon +.RB [ \-d ] .RB [ \-f ] .RB [ \-p .IR priority ] @@ -110,6 +111,16 @@ All devices marked as ``swap'' in .I /etc/fstab are made available, except for those with the ``noauto'' option. Devices that are already being used as swap are silently skipped. +.TP +.B "\-d, \-\-discard" +Swapping will discard clusters of swap pages in between freeing them +and re-writing to them, if the swap device supports that. +The +.I /etc/fstab +mount option +.BI discard +may be also used to enable discard flag. + .TP .B "\-e, \-\-ifexists" Silently skip devices that do not exist. -- cgit v1.2.3-55-g7522