From: Eric Sandeen <sandeen@redhat.com>
To: xfs-oss <xfs@oss.sgi.com>
Cc: "Lukáš Czerner" <lczerner@redhat.com>
Subject: [PATCH] xfstests 251: fix fitrim support test
Date: Fri, 13 May 2011 16:35:54 -0500 [thread overview]
Message-ID: <4DCDA43A.30502@redhat.com> (raw)
On my ext4 filesystem, the simple "did fstrim work" test passes,
because it asks to free all blocks in the first 10m of the fs,
and those 10m are full of filesystem metadata. Because no blocks
are free, no blocks are trimmed, and we get success returned.
But then when the test runs I'm flooded with error messages, because
it's a hard drive not an ssd...
So we need to step through the fs until we either free a block,
or encounter an error.
I think this is ugly bash, if anyone has a better plan I'm all ears.
(also change FSTRIM to FITRIM in the failure message, it seems
to be intended to print the ioctl name ...)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/251 b/251
index fa3d74a..5ab0a87 100755
--- a/251
+++ b/251
@@ -73,7 +73,19 @@ _fail()
_check_fstrim_support()
{
- $here/src/fstrim -l 10M $SCRATCH_MNT &> /dev/null
+ # Go until error or until something gets trimmed
+ step=1048576
+ start=0
+ retval=0
+ nonetrimmed=1
+
+ while [ $retval -eq 0 ] && [ $nonetrimmed -ne 0 ]; do
+ result=`$here/src/fstrim -v -s $start -l $step $SCRATCH_MNT 2>&1`
+ retval=$?
+ [ "${result:0:1}" -eq "0" ] && nonetrimmed=1
+ start=$(( $start + $step ))
+ done
+ return $retval
}
##
diff --git a/src/fstrim.c b/src/fstrim.c
index f1f37ec..ad7fd6a 100644
--- a/src/fstrim.c
+++ b/src/fstrim.c
@@ -236,7 +236,7 @@ int main(int argc, char **argv)
}
if (ioctl(fd, FITRIM, opts->range)) {
- fprintf(stderr, "%s: FSTRIM: %s\n", program_name,
+ fprintf(stderr, "%s: FITRIM %s\n", program_name,
strerror(errno));
goto free_opts;
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2011-05-13 21:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-13 21:35 Eric Sandeen [this message]
2011-05-16 9:19 ` [PATCH] xfstests 251: fix fitrim support test Lukas Czerner
2011-05-16 19:48 ` Eric Sandeen
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=4DCDA43A.30502@redhat.com \
--to=sandeen@redhat.com \
--cc=lczerner@redhat.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