On Sun, Oct 24, 2010 at 05:32:47PM -0700, Hugh Dickins wrote: > Below is the patch I tested with. I could sign it off, except for that > #ifndef SWAP_FLAG_DISCARD business at the start (I'm rather hoping that We have fallback solutions for many situations (include old system headers), so the #ifdef is expected thing :-) > Something else questionable about it, is that final "if (all && discard) > swapon_usage(stderr, 1)" hunk: I'm not sure what's best when you > "swapon -a -d", given that /etc/fstab can itself say "discard" or not; > I took the easiest way to code it up, and made "swapon -a -d" an error. Yes I agree, it's probably better to follow setting from the fstab file. > @@ -582,6 +589,8 @@ swapon_all(void) { > opt = strtok(NULL, ",")) { > if (strncmp(opt, "pri=", 4) == 0) > pri = atoi(opt+4); > + if (strcmp(opt, "discard") == 0) > + discard = 1; > if (strcmp(opt, "noauto") == 0) > skip = 1; > } > @@ -605,6 +614,7 @@ swapon_all(void) { > } > fclose(fp); > > + discard = 0; I think the discard=0 has to be also before opts parsing. (You don't have to re-send the patch to fix this tiny bug.) Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html