Skip to contentSkip to conversation

misc: allow zero duration for fsstress and fsx

PATCH In review Darrick J. Wong 3 participants 8 messages Jan 21 – Jan 24

lore
Share & tools
lore
#0 lore raw

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.

Cc <[email protected]> # v2023.05.01
Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")
---
 ltp/fsstress.c |    2 +-
 ltp/fsx.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ltp/fsstress.c +1 -1
index c17ac440414325..b51bd8ada2a3be 100644
@@ -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
index 626976dd4f9f27..4f8a2d5ab1fc08 100644
@@ -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);
 			}
Reviewed-by on v1 1/1
#1 lore raw
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:

Reviewed-by on v1 1/1
#2 lore raw
In reply to Darrick J. Wong
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.01
Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")
---
 ltp/fsstress.c |    2 +-
 ltp/fsx.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ltp/fsstress.c +1 -1
index c17ac440414325..b51bd8ada2a3be 100644
@@ -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
index 626976dd4f9f27..4f8a2d5ab1fc08 100644
@@ -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);
 			}
#3 lore raw
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.

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,
Zorro

Quoted 36 lines
Cc <[email protected]> # v2023.05.01
Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")
---
 ltp/fsstress.c |    2 +-
 ltp/fsx.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ltp/fsstress.c +1 -1
index c17ac440414325..b51bd8ada2a3be 100644
@@ -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
index 626976dd4f9f27..4f8a2d5ab1fc08 100644
@@ -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);
 			}
#4 lore raw
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.

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,
Zorro

Quoted 36 lines
Cc <[email protected]> # v2023.05.01
Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")
---
 ltp/fsstress.c |    2 +-
 ltp/fsx.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ltp/fsstress.c +1 -1
index c17ac440414325..b51bd8ada2a3be 100644
@@ -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
index 626976dd4f9f27..4f8a2d5ab1fc08 100644
@@ -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);
 			}
#5 lore raw
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.

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);
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,
Zorro

Quoted 45 lines

--D

Quoted 41 lines

Thanks,
Zorro

Quoted 36 lines
Cc <[email protected]> # v2023.05.01
Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")
---
 ltp/fsstress.c |    2 +-
 ltp/fsx.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ltp/fsstress.c +1 -1
index c17ac440414325..b51bd8ada2a3be 100644
@@ -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
index 626976dd4f9f27..4f8a2d5ab1fc08 100644
@@ -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);
 			}
#6 lore raw
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.

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);

}

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,
Zorro

Quoted 45 lines

--D

Quoted 41 lines

Thanks,
Zorro

Quoted 36 lines
Cc <[email protected]> # v2023.05.01
Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")
---
 ltp/fsstress.c |    2 +-
 ltp/fsx.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ltp/fsstress.c +1 -1
index c17ac440414325..b51bd8ada2a3be 100644
@@ -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
index 626976dd4f9f27..4f8a2d5ab1fc08 100644
@@ -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);
 			}
#7 lore raw
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.

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 :)

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,
Zorro

Quoted 54 lines

--D

Quoted 50 lines

Thanks,
Zorro

Quoted 45 lines

--D

Quoted 41 lines

Thanks,
Zorro

Quoted 36 lines
Cc <[email protected]> # v2023.05.01
Fixes 3e85dd4fe4236d ("misc: add duration for long soak tests")
---
 ltp/fsstress.c |    2 +-
 ltp/fsx.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
ltp/fsstress.c +1 -1
index c17ac440414325..b51bd8ada2a3be 100644
@@ -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
index 626976dd4f9f27..4f8a2d5ab1fc08 100644
@@ -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);
 			}