[PATCH] add discard option -d to swapon

Denys Vlasenko vda.linux at googlemail.com
Sun Mar 23 17:45:20 UTC 2014


Applied, thanks

On Sun, Mar 23, 2014 at 12:33 AM, Matt Whitlock
<busybox at mattwhitlock.name> wrote:
> Attached are a series of three patches affecting swaponoff.
>
> Patch #1 fixes two small logic errors: (a) the bb_strtou function was called inside an instantiation of the MIN macro, which would cause the function to be called twice in the common case; and (b) the actual maximum allowable swap priority is SWAP_FLAG_PRIO_MASK >> SWAP_FLAG_PRIO_SHIFT, not simply SWAP_FLAG_PRIO_MASK as the code previously assumed. It just so happens that SWAP_FLAG_PRIO_SHIFT == 0, but one should not rely on that serendipity.
>
> Patch #2 fixes the interaction of the -a and -p options to swapon. When -p is given on the command line, the specified priority should be applied to any swap areas given in /etc/fstab that lack a 'pri' option. This is the way swapon from util-linux does it, and it's the rational behavior, or else -p and -a should be mutually exclusive options.
>
> Patch #3 adds a -d option to swapon, which sets SWAP_FLAG_DISCARD and potentially SWAP_FLAG_DISCARD_ONCE or SWAP_FLAG_DISCARD_PAGES if a policy is given. The patch also adds support for the 'discard' option in swap entries in /etc/fstab.
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list