From: Lukas Czerner <lczerner@redhat.com>
To: xfs@oss.sgi.com
Cc: Lukas Czerner <lczerner@redhat.com>, aelder@sgi.com
Subject: [PATCH] 251: Make fstrim call a bit more random
Date: Tue, 28 Feb 2012 15:30:00 +0100 [thread overview]
Message-ID: <1330439400-26390-1-git-send-email-lczerner@redhat.com> (raw)
To cover cases when fstrim arguments are not block/block group/file
system size aligned, we can be a bit more random. This commit changes
fstrim argument computing to use $RANDOM bash variable in order to have
different minlen, start, len argument settings and change the full fs
fstrim to be called randomly as well.
Also make kill and wait not complain about non existent process, since
it may have already finished before we attempt to kill it and wait for
it. No reason to fail the test.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
251 | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/251 b/251
index fa3d74a..0b68898 100755
--- a/251
+++ b/251
@@ -54,21 +54,21 @@ _cleanup()
_destroy()
{
- kill $pids $fstrim_pid
- wait $pids $fstrim_pid
+ kill $pids $fstrim_pid 2> /dev/null
+ wait $pids $fstrim_pid 2> /dev/null
rm -rf $tmp
}
_destroy_fstrim()
{
- kill $fpid
- wait $fpid
+ kill $fpid 2> /dev/null
+ wait $fpid 2> /dev/null
}
_fail()
{
echo "$1"
- kill $mypid
+ kill $mypid 2> /dev/null
}
_check_fstrim_support()
@@ -87,13 +87,16 @@ fstrim_loop()
fsize=$(df | grep $SCRATCH_MNT | grep $SCRATCH_DEV | awk '{print $2}')
while true ; do
- step=1048576
+ step=$((RANDOM*$RANDOM))
+ minlen=$((RANDOM*($RANDOM%2+1)))
start=0
- $here/src/fstrim $SCRATCH_MNT &
- fpid=$!
- wait $fpid
+ if [ $((RANDOM%10)) -gt 7 ]; then
+ $here/src/fstrim $SCRATCH_MNT &
+ fpid=$!
+ wait $fpid
+ fi
while [ $start -lt $fsize ] ; do
- $here/src/fstrim -s ${start}k -l ${step}k $SCRATCH_MNT &
+ $here/src/fstrim -m ${minlen}k -s ${start}k -l ${step}k $SCRATCH_MNT &
fpid=$!
wait $fpid
start=$(( $start + $step ))
--
1.7.4.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2012-02-28 14:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-28 14:30 Lukas Czerner [this message]
2012-03-01 8:15 ` [PATCH v2] 251: Make fstrim call a bit more random Lukas Czerner
2012-03-20 12:02 ` Lukas Czerner
2012-03-31 20:13 ` [PATCH v2] 251: make " Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330439400-26390-1-git-send-email-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=aelder@sgi.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox