From: Andreas Gruenbacher <agruenba@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH 1/6] fsx: Small improvements and fixes
Date: Tue, 22 Dec 2015 14:51:07 +0100 [thread overview]
Message-ID: <1450792272-7402-2-git-send-email-agruenba@redhat.com> (raw)
In-Reply-To: <1450792272-7402-1-git-send-email-agruenba@redhat.com>
Move the run_fsx shell function into common/rc. Fix it to avoid
duplicate output on errors. Write the actual fsx parameters used into
$seqres.full instead of the BSIZE and PSIZE placeholders.
Include the symbolic fallocate mode in fsx error messages instead of the
numeric value. Use fprintf(stderr, ...) instead of warn() when
including strerror(errno) doesn't make sense.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
common/rc | 14 ++++++++++++++
ltp/fsx.c | 13 ++++++++-----
tests/generic/091 | 12 ------------
tests/generic/263 | 12 ------------
4 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/common/rc b/common/rc
index 4c2f42c..702ef47 100644
--- a/common/rc
+++ b/common/rc
@@ -3151,6 +3151,20 @@ get_block_size()
echo `stat -f -c %S $1`
}
+run_fsx()
+{
+ echo fsx $@
+ args=`echo $@ | sed -e "s/ BSIZE / $bsize /g" -e "s/ PSIZE / $psize /g"`
+ set -- $here/ltp/fsx $args $FSX_AVOID $TEST_DIR/junk
+ echo "$@" >>$seqres.full
+ rm -f $TEST_DIR/junk
+ "$@" 2>&1 | tee -a $seqres.full >$tmp.fsx
+ if [ ${PIPESTATUS[0]} -ne 0 ]; then
+ cat $tmp.fsx
+ exit 1
+ fi
+}
+
init_rc
################################################################################
diff --git a/ltp/fsx.c b/ltp/fsx.c
index 6da51e9..805fdfb 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -1557,16 +1557,20 @@ int aio_rw(int rw, int fd, char *buf, unsigned len, unsigned offset)
#endif
+#define test_fallocate(mode) __test_fallocate(mode, #mode)
+
int
-test_fallocate(int mode)
+__test_fallocate(int mode, const char *mode_str)
{
#ifdef HAVE_LINUX_FALLOC_H
int ret = 0;
if (!lite) {
if (fallocate(fd, mode, 0, 1) && errno == EOPNOTSUPP) {
if(!quiet)
- warn("main: filesystem does not support "
- "fallocate mode 0x%x, disabling!\n", mode);
+ fprintf(stderr,
+ "main: filesystem does not support "
+ "fallocate mode %s, disabling!\n",
+ mode_str);
} else {
ret = 1;
ftruncate(fd, 0);
@@ -1862,8 +1866,7 @@ main(int argc, char **argv)
if (keep_size_calls)
keep_size_calls = test_fallocate(FALLOC_FL_KEEP_SIZE);
if (punch_hole_calls)
- punch_hole_calls = test_fallocate(FALLOC_FL_PUNCH_HOLE |
- FALLOC_FL_KEEP_SIZE);
+ punch_hole_calls = test_fallocate(FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE);
if (zero_range_calls)
zero_range_calls = test_fallocate(FALLOC_FL_ZERO_RANGE);
if (collapse_range_calls)
diff --git a/tests/generic/091 b/tests/generic/091
index 30491bf..da54397 100755
--- a/tests/generic/091
+++ b/tests/generic/091
@@ -43,18 +43,6 @@ _require_odirect
rm -f $seqres.full
-run_fsx()
-{
- echo fsx $@ | tee -a $seqres.full
- args=`echo $@ | sed -e "s/ BSIZE / $bsize /g" -e "s/ PSIZE / $psize /g"`
- rm -f $TEST_DIR/junk
- $here/ltp/fsx $args $FSX_AVOID $TEST_DIR/junk >>$seqres.full 2>&1
- if [ $? -ne 0 ]; then
- cat $seqres.full
- exit 1
- fi
-}
-
psize=`$here/src/feature -s`
bsize=`_min_dio_alignment $TEST_DEV`
diff --git a/tests/generic/263 b/tests/generic/263
index 7584bc7..b460c82 100755
--- a/tests/generic/263
+++ b/tests/generic/263
@@ -43,18 +43,6 @@ _require_odirect
rm -f $seqres.full
-run_fsx()
-{
- echo fsx $@ | tee -a $seqres.full
- args=`echo $@ | sed -e "s/ BSIZE / $bsize /g" -e "s/ PSIZE / $psize /g"`
- rm -f $TEST_DIR/junk
- $here/ltp/fsx $args $FSX_AVOID $TEST_DIR/junk >>$seqres.full 2>&1
- if [ $? -ne 0 ]; then
- cat $seqres.full
- exit 1
- fi
-}
-
psize=`$here/src/feature -s`
bsize=`_min_dio_alignment $TEST_DEV`
--
2.4.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-12-22 13:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-22 13:51 [PATCH 0/6] fsx Andreas Gruenbacher
2015-12-22 13:51 ` Andreas Gruenbacher [this message]
2015-12-22 13:51 ` [PATCH 2/6] fsx: Fix hex numbers in operation dump Andreas Gruenbacher
2015-12-22 13:51 ` [PATCH 3/6] fsx: Report number of successful operations Andreas Gruenbacher
2015-12-22 13:51 ` [PATCH 4/6] fsx: Generate test parameters in test() Andreas Gruenbacher
2015-12-22 13:51 ` [PATCH 5/6] fsx: Improve operation logging Andreas Gruenbacher
2015-12-22 13:51 ` [PATCH 6/6] fsx: Add mechanism to replay failed operations Andreas Gruenbacher
2015-12-22 20:45 ` [PATCH 0/6] fsx Dave Chinner
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=1450792272-7402-2-git-send-email-agruenba@redhat.com \
--to=agruenba@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