Commit Graph

96 Commits

Author SHA1 Message Date
David Disseldorp 3ea91b080b fsx: fix compiler warning due to bad prototype
I see the following with gcc 4.8.5 [-Wunprototyped-calls]:
	warning: call to function 'cleanup' without a real prototype

Fix this by moving the function definition up, and dropping the
prototype.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-10-07 17:18:53 +08:00
Jeffrey Bastian ca7c8bcbe8 build: avoid struct fsxattr redefinition
Linux kernel v4.5 defines 'struct fsxattr' in linux/fs.h [0] but
it's still defined in xfs/linux.h as a backup [1].  If the files are
included in the wrong order, the compiler will complain with a
redefinition error.  This patch moves linux/fs.h (and linux/magic.h)
before the xfs headers for the t_immutable.c and fsstress.c tests.

[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=334e580a6f97e
[1] http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs/cmds/xfsprogs.git;a=blob;f=include/linux.h;h=cc0f70ceed72#l183

Signed-off-by: Jeffrey Bastian <jbastian@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-06-15 15:28:46 +08:00
Xiao Yang 234f51ebbd fsx.c: Add header file stdbool.h
Compilation failed on RHEL6.7GA because stdbool.h is not included in
xfs/platform_defs-x86_64.h or xfs/linux.h on RHEL6.7GA, so fix it.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-02-08 09:27:14 +11:00
Andreas Gruenbacher 2a78c1d1ba fsx: Add mechanism to replay failed operations
Create a $name.fsxops file next to $test.fsxlog.  When a test fails,
dump the operations in the log into that file in a simple, parseable
format like:

  fallocate 0x2e0f2 0xf04a 0x0 keep_size
  truncate 0x0 0x11e00 0x0 *
  write 0x73400 0x6c00 0x11e00
  skip punch_hole 0x71539913 0xdf76 0x7a000 close_open
  mapread 0x56000 0x16d08 0x7a000

Here, each operation is on a separate line. When the first word is
"skip", the operation will be skipped.  The next parameters are offset,
length, and the current file size, followed by optional flags like
keep_size and clode_open.  A trailing asterisk indicates that the
operation overlaps with the operation that has failed.

Add a --replay-ops option that allows to replay the operations recorded
in such a $name.fsxops file.  (The log can be modified to easily narrow
down which operations are causing the failure.)

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-01-11 14:45:26 +11:00
Andreas Gruenbacher ed49ff0eba fsx: Improve operation logging
Add FL_SKIPPED, FL_CLOSE_OPEN, and FL_KEEP_SIZE flags to the log
entries.  Use FL_SKIPPED to indicate that an operation was skipped.  Use
FL_CLOSE_OPEN to encode when an operation is followed by a close/open
cycle.  Use FL_KEEP_SIZE to indicate when the OP_ZERO_RANGE and
OP_FALLOCATE operations should keep the file size unchanged and put the
current file size into args[2] so that we can tell which operation was
actually called from the log.

After that, arg2 of log4 is always either unused or the current file size, so
remove it and unconditionally remember the current file size.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-01-11 14:45:13 +11:00
Andreas Gruenbacher e1598eb840 fsx: Generate test parameters in test()
Generate all test parameters in test(), including keep_size.

The code is slightly more complicated than it could be to produce the
same sequence of operations for the same random seed.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-01-11 14:44:51 +11:00
Andreas Gruenbacher 6b7be00b07 fsx: Report number of successful operations
Report the number of successful operations at the end of an fsx run.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-01-11 14:44:21 +11:00
Andreas Gruenbacher c8ba07126c fsx: Fix hex numbers in operation dump
Some hex numbers are prefixed with "0x" and right-aligned with spaces,
leading to output like "0x beef".  Make that "0x0beef" instead.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-01-11 14:44:05 +11:00
Andreas Gruenbacher 3597757462 fsx: Small improvements and fixes
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>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2016-01-11 14:43:40 +11:00
Dave Chinner 8c3016bc84 xfstests: fix build errors and warnings
After upgrading userspace on test machines to xfsprogs-4.2.0-rc1,
lots of build warnings and failures are exposed from implicit
includes that no longer exist. Hence these need fixing to allow
fstests to build correctly.

gcc also seems to have grown new stupidities around uninitialised
variables, so fix them while touching the same files.

Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-08-04 16:34:42 +10:00
Theodore Ts'o ad75f28690 fsstress: add the -c option
This option causes fsstress to delete the test directory between each
run.  This is the opposite from the ltp version of fsstress, which
deletes the test directory by default, and the -c option caused ltp's
fsstress _not_ to delete the test directory.

It can be useful to be able to have the same test behavior as ltp
version, and although reversing the sense of the option is
unfortunate, it also reserves the -c option, which makes it a bit
easier if we want to eventually have one version which is a superset
of the xfstest and ltp version of fsstress.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-08-04 14:10:44 +10:00
Theodore Ts'o cf67ba1e32 fsstress: add the [-l loops] option
This feature is in the ltp version of fsstress; port it into
xfstests.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-08-04 14:10:44 +10:00
Namjae Jeon 788b13485b fsx: Add fallocate insert range operation
This commit adds fallocate FALLOC_FL_INSERT_RANGE support for fsx.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-02-25 15:35:08 +11:00
Namjae Jeon 6e5194daba fsstress: Add fallocate insert range operation
This commit adds insert operation support for fsstress, which is
meant to exercise fallocate FALLOC_FL_INSERT_RANGE support.

[dchinner: turn off this op for xfs/068, which expects an exact
outcome from the fsstress execution. ]

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-02-25 15:34:48 +11:00
Anna Schumaker 3de543f791 fsx: check for filesystem support of FALLOCATE_FL_KEEP_SIZE
The NFS implementation of fallocate() does not support passing the
KEEP_SIZE flag by itself, causing tests to randomly fail.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-02-12 14:14:20 +11:00
Christoph Hellwig a66f3c3f70 fsx: increase number of logged operations
1000 operations is not nearly enough to debug complex data integrity
issues, so increase the log buffer by an order of magnitude.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-09-29 13:11:05 +10:00
Namjae Jeon 995a459e7a fsstress: fix incorrect if condition check for collapse range mode
There is if condition to be block aligned for off and len of Collapse range.
But off and len for all fallocate opearion can be aligned by incorrect
if condition check.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-05-13 15:26:59 +10:00
Namjae Jeon d37388c21b fsstress: remove duplicate COLLAPSE_RANGE flags
Remove duplicate COLLAPSE_RANGE flags

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-04-22 10:46:12 +10:00
Lukas Czerner f98d930f3f fsstress: Add fallocate collapse range operation
This commit adds collapse operation support for fsstress, which is
meant to exercise fallocate FALLOC_FL_COLLAPSE_RANGE support.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-04-04 17:23:14 +11:00
Lukas Czerner 5f8c711c02 fsx: Add fallocate collapse range operation
This commit adds fallocate FALLOC_FL_COLLAPSE_RANGE support for fsx.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-04-04 17:22:29 +11:00
Lukas Czerner f074613829 fsx: Add fallocate zero range operation
This commit adds fallocate FALLOC_FL_ZERO_RANGE support for fsx.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-03-13 15:19:58 +11:00
Lukas Czerner 4544179a64 fsstress: translate flags in fiemap_f
Translate flags in fiemap_f output to human readable strings.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-03-13 15:19:56 +11:00
Lukas Czerner 2d2d853625 fsstress: Add fallocate zero range operation
This commit adds fzero operation support for fsstress, which is meant to
exercise fallocate FALLOC_FL_ZERO_RANGE support.

Also reorganise the common fallocate code into a single do_fallocate()
function and use flags use the right mode.

Also in order to make more obvious which fallocate mode fsstress is
testing translate fallocate flags into human readable strings.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-03-13 15:19:53 +11:00
Lukas Czerner 2dc43e03e6 build: Move fallocate include into global.h
Move the inclusion of falloc.h with all it's possible defines for the
fallocate mode into global.h header file so we do not have to include
and define it manually in every tool using fallocate.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-03-13 15:19:52 +11:00
Dmitry Monakhov 336581726f fsstress: add verifiable logging mode
- It would be useful to have verifiable logging mode which will contain
  only deterministic information which allow to compare two logs files
  generated from two runs with same seed.
- Also add missed help for '-o logfile' option

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-03-13 15:18:01 +11:00