From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 3/4] xfstests: fix brain-o in fallocate log dump
Date: Fri, 8 Jul 2011 10:53:45 +1000 [thread overview]
Message-ID: <1310086426-30605-4-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1310086426-30605-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
fsx segvs when dumping fallocate log entries. Fix magic string
array index parameters to be zero based rather than one based.
While touching log string related stuff, make the format consistent
with read and write operations so the log dump is easier to look at
with the human eye.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
ltp/fsx.c | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/ltp/fsx.c b/ltp/fsx.c
index 41d7c20..62dea0b 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -252,14 +252,14 @@ logdump(void)
int opnum;
opnum = i+1 + (logcount/LOGSIZE)*LOGSIZE;
- prt("%d(%d mod 256): ", opnum, opnum%256);
+ prt("%d(%3d mod 256): ", opnum, opnum%256);
lp = &oplog[i];
if ((closeopen = lp->operation < 0))
lp->operation = ~ lp->operation;
switch (lp->operation) {
case OP_MAPREAD:
- prt("MAPREAD\t0x%x thru 0x%x\t(0x%x bytes)",
+ prt("MAPREAD 0x%x thru 0x%x\t(0x%x bytes)",
lp->args[0], lp->args[0] + lp->args[1] - 1,
lp->args[1]);
if (badoff >= lp->args[0] && badoff <
@@ -275,7 +275,7 @@ logdump(void)
prt("\t******WWWW");
break;
case OP_READ:
- prt("READ\t0x%x thru 0x%x\t(0x%x bytes)",
+ prt("READ 0x%x thru 0x%x\t(0x%x bytes)",
lp->args[0], lp->args[0] + lp->args[1] - 1,
lp->args[1]);
if (badoff >= lp->args[0] &&
@@ -283,7 +283,7 @@ logdump(void)
prt("\t***RRRR***");
break;
case OP_WRITE:
- prt("WRITE\t0x%x thru 0x%x\t(0x%x bytes)",
+ prt("WRITE 0x%x thru 0x%x\t(0x%x bytes)",
lp->args[0], lp->args[0] + lp->args[1] - 1,
lp->args[1]);
if (lp->args[0] > lp->args[2])
@@ -304,14 +304,15 @@ logdump(void)
break;
case OP_FALLOCATE:
/* 0: offset 1: length 2: where alloced */
- prt("FALLOCATE %s\tfrom 0x%x to 0x%x",
- falloc_type[lp->args[2]], lp->args[0], lp->args[0] + lp->args[1]);
+ prt("FALLOC 0x%x thru 0x%x\t(0x%x bytes) %s",
+ lp->args[0], lp->args[0] + lp->args[1],
+ lp->args[1], falloc_type[lp->args[2]]);
if (badoff >= lp->args[0] &&
badoff < lp->args[0] + lp->args[1])
prt("\t******FFFF");
break;
case OP_PUNCH_HOLE:
- prt("PUNCH HOLE\t0x%x thru 0x%x\t(0x%x bytes)",
+ prt("PUNCH 0x%x thru 0x%x\t(0x%x bytes)",
lp->args[0], lp->args[0] + lp->args[1] - 1,
lp->args[1]);
if (badoff >= lp->args[0] && badoff <
@@ -906,12 +907,12 @@ do_preallocate(unsigned offset, unsigned length)
}
/*
- * last arg:
- * 1: allocate past EOF
- * 2: extending prealloc
- * 3: interior prealloc
+ * last arg matches fallocate string array index in logdump:
+ * 0: allocate past EOF
+ * 1: extending prealloc
+ * 2: interior prealloc
*/
- log4(OP_FALLOCATE, offset, length, (end_offset > file_size) ? (keep_size ? 1 : 2) : 3);
+ log4(OP_FALLOCATE, offset, length, (end_offset > file_size) ? (keep_size ? 0 : 1) : 2);
if (end_offset > file_size) {
memset(good_buf + file_size, '\0', end_offset - file_size);
@@ -924,7 +925,8 @@ do_preallocate(unsigned offset, unsigned length)
if ((progressinterval && testcalls % progressinterval == 0) ||
(debug && (monitorstart == -1 || monitorend == -1 ||
end_offset <= monitorend)))
- prt("%lu falloc\tfrom 0x%x to 0x%x\n", testcalls, offset, length);
+ prt("%lu falloc\tfrom 0x%x to 0x%x (0x%x bytes)\n", testcalls,
+ offset, offset + length, length);
if (fallocate(fd, keep_size ? FALLOC_FL_KEEP_SIZE : 0, (loff_t)offset, (loff_t)length) == -1) {
prt("fallocate: %x to %x\n", offset, length);
prterr("do_preallocate: fallocate");
--
1.7.5.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-07-08 0:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-08 0:53 [PATCH 0/4, V2] xfstests: fsx is fallocate challenged Dave Chinner
2011-07-08 0:53 ` [PATCH 1/4] xfstests: fix fsx fpunch test to actually test for fpunch Dave Chinner
2011-07-08 17:56 ` Alex Elder
2011-07-08 0:53 ` [PATCH 2/4] xfstests: fsx fallocate support is b0rked Dave Chinner
2011-07-08 18:58 ` Alex Elder
2011-07-11 6:14 ` Dave Chinner
2011-07-08 0:53 ` Dave Chinner [this message]
2011-07-08 19:02 ` [PATCH 3/4] xfstests: fix brain-o in fallocate log dump Alex Elder
2011-07-08 0:53 ` [PATCH 4/4] xfstests: add mapped write fsx operations to 091 Dave Chinner
2011-07-08 19:04 ` Alex Elder
-- strict thread matches above, loose matches on Subject: below --
2011-06-27 5:48 ***** SUSPECTED SPAM ***** [PATCH 0/4] xfstests: fsx is fallocate challenged Dave Chinner
2011-06-27 5:48 ` [PATCH 3/4] xfstests: fix brain-o in fallocate log dump Dave Chinner
2011-06-27 21:32 ` 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=1310086426-30605-4-git-send-email-david@fromorbit.com \
--to=david@fromorbit.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