xfs
[Top] [All Lists]

[PATCH 2/2] 251: Do not allow step to be zero

To: xfs@xxxxxxxxxxx
Subject: [PATCH 2/2] 251: Do not allow step to be zero
From: Lukas Czerner <lczerner@xxxxxxxxxx>
Date: Tue, 16 Oct 2012 11:41:34 +0200
Cc: david@xxxxxxxxxxxxx, Lukas Czerner <lczerner@xxxxxxxxxx>
In-reply-to: <1350380494-17482-1-git-send-email-lczerner@xxxxxxxxxx>
References: <1350380494-17482-1-git-send-email-lczerner@xxxxxxxxxx>
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@xxxxxxxxxx>
---
 251 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/251 b/251
index f46b6e2..373afd0 100755
--- a/251
+++ b/251
@@ -98,7 +98,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
-- 
1.7.7.6

<Prev in Thread] Current Thread [Next in Thread>