Messages in this thread | | | Date | Mon, 20 May 2013 21:02:43 -0400 | From | KOSAKI Motohiro <> | Subject | Re: [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).
| |