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

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

 



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':		/* all */
> @@ -738,8 +753,11 @@ int main(int argc, char *argv[])
>  		case 'U':
>  			add_uuid(optarg);
>  			break;
> +		case 'c':
> +			discard += 2;
> +			break;
>  		case 'd':
> -			discard = 1;
> +			discard += 1;

 this is fragile, it would be better to use

        case 'c':
            discard |= SWAP_FLAG_DISCARD_CLUSTER;
            break;
        case 'd':
            discard |= SWAP_FLAG_DISCARD;
            break;

 and use directly the flags everywhere in the code than use magical
 numbers '1' and '2' etc.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com

--
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]