misc: allow zero duration for fsstress and fsx
PATCH 1/1 misc: allow zero duration for fsstress and fsx
From: Darrick J. Wong <[email protected]>
Occasionally the common/fuzzy fuzz test helpers manage to time something just right such that fsx or fsstress get invoked with a zero second duration. It's harmless to exit immediately without doing anything, so allow this corner case.
--- ltp/fsstress.c | 2 +- ltp/fsx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
ltp/fsstress.c +1 -1
@@ -645,7 +645,7 @@ int main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }
ltp/fsx.c +1 -1
@@ -3375,7 +3375,7 @@ main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }
Quoted 6 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Occasionally the common/fuzzy fuzz test helpers manage to time something just right such that fsx or fsstress get invoked with a zero second duration. It's harmless to exit immediately without doing anything, so allow this corner case.
Looks good:
Quoted 6 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Occasionally the common/fuzzy fuzz test helpers manage to time something just right such that fsx or fsstress get invoked with a zero second duration. It's harmless to exit immediately without doing anything, so allow this corner case.
Sure, duration=0 is harmless, I'm good with this patch.
Please excuse my nitpicking. I'm curious about the semantics of "--duration=0". Looking at the output of fsstress -v --duration=0, it doesn't actually 'do nothing.' Instead, it behaves similarly to duration=1, where fsstress attempts to execute operations before timing out and exiting :-D
Thanks,
Zorro
Quoted 36 lines
Cc <[email protected]> # v2023.05.01Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")Signed-off-by "Darrick J. Wong" <[email protected]>--- ltp/fsstress.c | 2 +- ltp/fsx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)ltp/fsstress.c +1
-1@@ -645,7 +645,7 @@ int main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }ltp/fsx.c +1
-1@@ -3375,7 +3375,7 @@ main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }
Quoted 8 lines · Zorro Lang
Quoted 6 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Occasionally the common/fuzzy fuzz test helpers manage to time something just right such that fsx or fsstress get invoked with a zero second duration. It's harmless to exit immediately without doing anything, so allow this corner case.
Quoted 8 lines
Sure, duration=0 is harmless, I'm good with this patch.
Reviewed-by Zorro Lang <[email protected]>Please excuse my nitpicking. I'm curious about the semantics of "--duration=0". Looking at the output of
fsstress -v --duration=0, it doesn't actually 'do nothing.' Instead, it behaves similarly to duration=1, where fsstress attempts to execute operations before timing out and exiting :-D
Yeah, I suppose it's possible to do a very small amount of work.
Would you mind changing that last sentence to read "It's harmless to exit almost immediately having done very little work, so allow this corner case." prior to commit?
--D
Quoted 41 lines
Thanks,
ZorroQuoted 36 lines
Cc <[email protected]> # v2023.05.01Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")Signed-off-by "Darrick J. Wong" <[email protected]>--- ltp/fsstress.c | 2 +- ltp/fsx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)ltp/fsstress.c +1
-1@@ -645,7 +645,7 @@ int main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }ltp/fsx.c +1
-1@@ -3375,7 +3375,7 @@ main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }
Quoted 18 lines · Darrick J. Wong
Quoted 8 lines · Zorro Lang
Quoted 6 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Occasionally the common/fuzzy fuzz test helpers manage to time something just right such that fsx or fsstress get invoked with a zero second duration. It's harmless to exit immediately without doing anything, so allow this corner case.
Quoted 8 lines
Sure, duration=0 is harmless, I'm good with this patch.
Reviewed-by Zorro Lang <[email protected]>Please excuse my nitpicking. I'm curious about the semantics of "--duration=0". Looking at the output of
fsstress -v --duration=0, it doesn't actually 'do nothing.' Instead, it behaves similarly to duration=1, where fsstress attempts to execute operations before timing out and exiting :-D
Quoted 5 lines
Yeah, I suppose it's possible to do a very small amount of work.
Would you mind changing that last sentence to read "It's harmless to exit almost immediately having done very little work, so allow this corner case." prior to commit?
Sure Darick, I can make that change prior to commit :) But I was just curious to hear your thoughts on:
if (duration == 0) {
/* No action is taken if duration is 0 */
exit(0);
} else if (duration < 0) {
fprintf(stderr, "%lld: invalid duration\n", duration);
exit(88);}
do you feel that makes more sense semantically :)
Thanks,
Zorro
Quoted 45 lines
--D
Quoted 41 lines
Thanks,
ZorroQuoted 36 lines
Cc <[email protected]> # v2023.05.01Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")Signed-off-by "Darrick J. Wong" <[email protected]>--- ltp/fsstress.c | 2 +- ltp/fsx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)ltp/fsstress.c +1
-1@@ -645,7 +645,7 @@ int main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }ltp/fsx.c +1
-1@@ -3375,7 +3375,7 @@ main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }
Quoted 34 lines · Zorro Lang
Quoted 18 lines · Darrick J. Wong
Quoted 8 lines · Zorro Lang
Quoted 6 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Occasionally the common/fuzzy fuzz test helpers manage to time something just right such that fsx or fsstress get invoked with a zero second duration. It's harmless to exit immediately without doing anything, so allow this corner case.
Quoted 8 lines
Sure, duration=0 is harmless, I'm good with this patch.
Reviewed-by Zorro Lang <[email protected]>Please excuse my nitpicking. I'm curious about the semantics of "--duration=0". Looking at the output of
fsstress -v --duration=0, it doesn't actually 'do nothing.' Instead, it behaves similarly to duration=1, where fsstress attempts to execute operations before timing out and exiting :-DQuoted 5 lines
Yeah, I suppose it's possible to do a very small amount of work.
Would you mind changing that last sentence to read "It's harmless to exit almost immediately having done very little work, so allow this corner case." prior to commit?
Sure Darick, I can make that change prior to commit :) But I was just curious to hear your thoughts on:
if (duration == 0) { /* No action is taken if duration is 0 */ exit(0); } else if (duration < 0) { fprintf(stderr, "%lld: invalid duration\n", duration); exit(88);
Quoted 3 lines
}
do you feel that makes more sense semantically :)
That would also work. Would you rather have the exits-immediately version?
--D
Quoted 50 lines
Thanks,
ZorroQuoted 45 lines
--D
Quoted 41 lines
Thanks,
ZorroQuoted 36 lines
Cc <[email protected]> # v2023.05.01Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")Signed-off-by "Darrick J. Wong" <[email protected]>--- ltp/fsstress.c | 2 +- ltp/fsx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)ltp/fsstress.c +1
-1@@ -645,7 +645,7 @@ int main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }ltp/fsx.c +1
-1@@ -3375,7 +3375,7 @@ main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }
Quoted 37 lines · Darrick J. Wong
Quoted 36 lines · Zorro Lang
Quoted 18 lines · Darrick J. Wong
Quoted 8 lines · Zorro Lang
Quoted 6 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Occasionally the common/fuzzy fuzz test helpers manage to time something just right such that fsx or fsstress get invoked with a zero second duration. It's harmless to exit immediately without doing anything, so allow this corner case.
Quoted 8 lines
Sure, duration=0 is harmless, I'm good with this patch.
Reviewed-by Zorro Lang <[email protected]>Please excuse my nitpicking. I'm curious about the semantics of "--duration=0". Looking at the output of
fsstress -v --duration=0, it doesn't actually 'do nothing.' Instead, it behaves similarly to duration=1, where fsstress attempts to execute operations before timing out and exiting :-DQuoted 5 lines
Yeah, I suppose it's possible to do a very small amount of work.
Would you mind changing that last sentence to read "It's harmless to exit almost immediately having done very little work, so allow this corner case." prior to commit?
Sure Darick, I can make that change prior to commit :) But I was just curious to hear your thoughts on:
if (duration == 0) { /* No action is taken if duration is 0 */ exit(0); } else if (duration < 0) { fprintf(stderr, "%lld: invalid duration\n", duration); exit(88);}
Quoted 4 lines
Quoted 1 line
do you feel that makes more sense semantically :)
That would also work. Would you rather have the exits-immediately version?
If both versions are good to you, I perfer the "exits-immediately" one, at least it fits the semantics of 0 better :)
To save your time I can make this change when I merge it if you agree with that too. Let me know if there's anything else you'd like to add.
Thanks,
Zorro
Quoted 54 lines
--D
Quoted 50 lines
Thanks,
ZorroQuoted 45 lines
--D
Quoted 41 lines
Thanks,
ZorroQuoted 36 lines
Cc <[email protected]> # v2023.05.01Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")Signed-off-by "Darrick J. Wong" <[email protected]>--- ltp/fsstress.c | 2 +- ltp/fsx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)ltp/fsstress.c +1
-1@@ -645,7 +645,7 @@ int main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }ltp/fsx.c +1
-1@@ -3375,7 +3375,7 @@ main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }
Quoted 40 lines · Zorro Lang
Quoted 39 lines · Darrick J. Wong
Quoted 37 lines · Zorro Lang
Quoted 18 lines · Darrick J. Wong
Quoted 8 lines · Zorro Lang
Quoted 6 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Occasionally the common/fuzzy fuzz test helpers manage to time something just right such that fsx or fsstress get invoked with a zero second duration. It's harmless to exit immediately without doing anything, so allow this corner case.
Quoted 8 lines
Sure, duration=0 is harmless, I'm good with this patch.
Reviewed-by Zorro Lang <[email protected]>Please excuse my nitpicking. I'm curious about the semantics of "--duration=0". Looking at the output of
fsstress -v --duration=0, it doesn't actually 'do nothing.' Instead, it behaves similarly to duration=1, where fsstress attempts to execute operations before timing out and exiting :-DQuoted 5 lines
Yeah, I suppose it's possible to do a very small amount of work.
Would you mind changing that last sentence to read "It's harmless to exit almost immediately having done very little work, so allow this corner case." prior to commit?
Sure Darick, I can make that change prior to commit :) But I was just curious to hear your thoughts on:
if (duration == 0) { /* No action is taken if duration is 0 */ exit(0); } else if (duration < 0) { fprintf(stderr, "%lld: invalid duration\n", duration); exit(88);}
do you feel that makes more sense semantically :)
Quoted 8 lines
Quoted 2 lines
That would also work. Would you rather have the exits-immediately version?
If both versions are good to you, I perfer the "exits-immediately" one, at least it fits the semantics of 0 better :)
To save your time I can make this change when I merge it if you agree with that too. Let me know if there's anything else you'd like to add.
Your way is fine with me. I don't think I have anything to add, and if I do I can always send a patch. :)
--D
Quoted 58 lines
Thanks,
ZorroQuoted 54 lines
--D
Quoted 50 lines
Thanks,
ZorroQuoted 45 lines
--D
Quoted 41 lines
Thanks,
ZorroQuoted 36 lines
Cc <[email protected]> # v2023.05.01Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")Signed-off-by "Darrick J. Wong" <[email protected]>--- ltp/fsstress.c | 2 +- ltp/fsx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)ltp/fsstress.c +1
-1@@ -645,7 +645,7 @@ int main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }ltp/fsx.c +1
-1@@ -3375,7 +3375,7 @@ main(int argc, char **argv)exit (87 ); } duration =strtoll (optarg,NULL ,0 ); -if (duration <1 ) { +if (duration <0 ) {fprintf (stderr,"%lld: invalid duration\n" , duration);exit (88 ); }