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@vger.kernel.org # v2023.10.29
Fixes: 95b0db739400c2 ("generic/251: check min and max length and minlen for FSTRIM")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
# 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
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