lkml.org 
[lkml]   [2013]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 02/02] swapon: add "cluster-discard" support
> +.B "\-c, \-\-cluster\-discard"
> +Swapping will discard clusters of swap pages in between freeing them
> +and re-writing to them, if the swap device supports that. This option
> +also implies the
> +.I \-d, \-\-discard
> +swapon flag.

I'm not sure this is good idea. Why can't we make these flags orthogonal?


> /* If true, don't complain if the device/file doesn't exist */
> static int ifexists;
> @@ -570,8 +574,11 @@ static int do_swapon(const char *orig_special, int prio,
> << SWAP_FLAG_PRIO_SHIFT);
> }
> #endif
> - if (fl_discard)
> + if (fl_discard) {
> flags |= SWAP_FLAG_DISCARD;
> + if (fl_discard > 1)
> + flags |= SWAP_FLAG_DISCARD_CLUSTER;

This is not enough, IMHO. When running this code on old kernel, swapon() return EINVAL.
At that time, we should fall back swapon(0x10000).



\
 
 \ /
  Last update: 2013-05-21 04:01    [W:0.086 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site