xfstests: Do not allow step to be zero
authorLukas Czerner <lczerner@redhat.com>
Tue, 16 Oct 2012 09:41:34 +0000 (09:41 +0000)
committerRich Johnston <rjohnston@sgi.com>
Wed, 24 Oct 2012 18:11:56 +0000 (13:11 -0500)
Currently 'step' variable which is used as length of the range to
discard can be zero. However it would result in error returned by the
fstrim.

Fix this by forcing 'step' to be at least 4KB.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
251

diff --git a/251 b/251
index dbb6ba73ed85e3516f4c53ef71b1efce2b79dc52..74f999467f70cde54bacb0180e56869a470f8677 100755 (executable)
--- a/251
+++ b/251
@@ -94,7 +94,7 @@ fstrim_loop()
        mmlen=$(_guess_max_minlen)
 
        while true ; do
-               step=$((RANDOM*$RANDOM))
+               step=$((RANDOM*$RANDOM+4))
                minlen=$(((RANDOM*($RANDOM%2+1))%$mmlen))
                start=$RANDOM
                if [ $((RANDOM%10)) -gt 7 ]; then