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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +.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).

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]