From: Darrick J. Wong <djwong@xxxxxxxxxx> There's no reason to wait until fstrim_loop to detect the length constraints on the FITRIM call since failing to detect any constraints just leads to _notrun. Run that stuff from the top level scope so that we don't start up a bunch of exercisers for no good reason. Cc: <fstests@xxxxxxxxxxxxxxx> # v2023.10.29 Fixes: 95b0db739400c2 ("generic/251: check min and max length and minlen for FSTRIM") Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> --- tests/generic/251 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/generic/251 b/tests/generic/251 index 644adf07cc42d5..1fb26f4caa3732 100755 --- a/tests/generic/251 +++ b/tests/generic/251 @@ -103,11 +103,6 @@ fstrim_loop() # always remove the $tmp.fstrim_loop file on exit trap "_destroy_fstrim; exit \$status" 2 15 EXIT - set_minlen_constraints - set_length_constraints - echo "MINLEN max=$FSTRIM_MAX_MINLEN min=$FSTRIM_MIN_MINLEN" >> $seqres.full - echo "LENGTH max=$FSTRIM_MAX_LEN min=$FSTRIM_MIN_LEN" >> $seqres.full - fsize=$(_discard_max_offset_kb "$SCRATCH_MNT" "$SCRATCH_DEV") while true ; do @@ -177,6 +172,12 @@ function run_process() { nproc=$((4 * LOAD_FACTOR)) +# Discover the fstrim constraints before we do anything else +set_minlen_constraints +set_length_constraints +echo "MINLEN max=$FSTRIM_MAX_MINLEN min=$FSTRIM_MIN_MINLEN" >> $seqres.full +echo "LENGTH max=$FSTRIM_MAX_LEN min=$FSTRIM_MIN_LEN" >> $seqres.full + # Use fsstress to create a directory tree with some variability content=$SCRATCH_MNT/orig mkdir -p $content