Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support

2013-05-22 Thread Jeff Moyer
KOSAKI Motohiro writes: >> Instead of reverting and renaming --discard, what about making it accept an >> optional argument, so we could use --discard (to enable all thing and keep >> backward compatibility); --discard=cluster & --discard=batch (or whatever we >> think it should be named). I'll t

Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support

2013-05-21 Thread KOSAKI Motohiro
> Instead of reverting and renaming --discard, what about making it accept an > optional argument, so we could use --discard (to enable all thing and keep > backward compatibility); --discard=cluster & --discard=batch (or whatever we > think it should be named). I'll try to sort this approach out i

Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support

2013-05-21 Thread Rafael Aquini
Karel, Motohiro, Thanks a lot for your time reviewing this patch and providing me with valuable feedback. On Tue, May 21, 2013 at 04:17:04PM -0400, KOSAKI Motohiro wrote: > (5/21/13 6:26 AM), Karel Zak wrote: > > On Mon, May 20, 2013 at 09:02:43PM -0400, KOSAKI Motohiro wrote: > >>> - if (fl_disc

Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support

2013-05-21 Thread KOSAKI Motohiro
(5/21/13 6:26 AM), Karel Zak wrote: > On Mon, May 20, 2013 at 09:02:43PM -0400, KOSAKI Motohiro wrote: >>> - if (fl_discard) >>> + if (fl_discard) { >>> flags |= SWAP_FLAG_DISCARD; >>> + if (fl_discard > 1) >>> + flags |= SWAP_FLAG_DISCARD_CLUSTER; >> >>

Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support

2013-05-21 Thread Karel Zak
On Mon, May 20, 2013 at 09:02:43PM -0400, KOSAKI Motohiro wrote: > > - 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

Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support

2013-05-21 Thread Karel Zak
On Mon, May 20, 2013 at 09:04:25PM -0300, Rafael Aquini wrote: > - while ((c = getopt_long(argc, argv, "ahdefp:svVL:U:", > + while ((c = getopt_long(argc, argv, "ahcdefp:svVL:U:", > long_opts, NULL)) != -1) { > switch (c) { > case 'a

Re: [RFC PATCH 02/02] swapon: add "cluster-discard" support

2013-05-20 Thread KOSAKI Motohiro
> +.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 flag

[RFC PATCH 02/02] swapon: add "cluster-discard" support

2013-05-20 Thread Rafael Aquini
Introduce a new swapon flag/option to support more flexible swap discard setup. The --cluster-discard swapon(8) option can be used by a system admin to flag sys_swapon() to perform page-cluster fine-grained discards. This patch also changes the behaviour of swapon(8) --discard option, that now wil