Skip to contentSkip to conversation

fstests: add dm-log-writes test and supporting code

RFC PATCH New Josef Bacik 1 participant 1 message Jan 9, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 fstests: add dm-log-writes test and supporting code

This is a proof of concept that I've gotten working with my dm-log-writes target. I'd like to get feedback on this test and my approach in general. Currently this test fails on XFS because of either the ZERO RANGE or COLLAPSE RANGE operations in fsx. If I turn those off it passes fine as do all the other file systems. This depends on the target I've posted in dm-devel and you can find here

https://git.kernel.org/cgit/linux/kernel/git/josef/btrfs-next.git/log/?h=dm-log-writes

My goal is to do this, to do an fsstress one that simply walks through each individual FUA and verify the consistency of the fs, and then add a bunch of btrfs specific ones for btrfs's weird things, like balance and such. Thanks,

Josef

Subject: [PATCH] fstests: add dm-log-writes test and supporting code

This patch adds the supporting code for using the dm-log-writes target. The bash stuff is similar to the dmflakey code, it just gives us functions to build and tear down a dm-log-writes target. We add a new LOGWRITES_DEV variable to take in the device we will use as the log and add checks for that.

I've rigged up fsx to have an integrity check mode. Basically it works like it normally works, but when it fsync()'s it marks the log with a unique mark and dumps it's buffer to a file with the mark in the filename. I did this with a system() call simply because it was the fastest. I can link the device-mapper libraries and do it programatically if that would be preferred, but this works pretty well.

The test itself just runs 200 ops and exits, then finds all of the good buffers in the directory we provided and replays up to the mark given, mounts the file system and compares the md5sum, unmounts and fsck's to check for metadata integrity. dm-log-writes will pretend to do discard and the replay tool will replay it properly depending on the underlying device, either by writing 0's or actually calling the discard ioctl, so I've enabled discard in the test for maximum fun.

This test relies on the supporting userspace code I've written for dm-logs-writes. It can be found here

https://github.com/josefbacik/log-writes.git

Thanks,

---
 README                |   2 +
 common/dmlogwrites    |  80 ++++++++++++++++++++++++++++++
 common/rc             |  17 +++++++
 ltp/fsx.c             | 132 ++++++++++++++++++++++++++++++++++++++++++--------
 tests/generic/039     |  99 +++++++++++++++++++++++++++++++++++++
 tests/generic/039.out |   2 +
 tests/generic/group   |   1 +
 7 files changed, 314 insertions(+), 19 deletions(-)
 create mode 100644 common/dmlogwrites
 create mode 100644 tests/generic/039
 create mode 100644 tests/generic/039.out
README +2 -0
index 0c9449a..112478e 100644
@@ -78,6 +78,8 @@ Preparing system for tests (IRIX and Linux):
                added to the end of fsstresss and fsx invocations, respectively,
                in case you wish to exclude certain operational modes from these
                tests.
+             - setenv LOGWRITES_DEV to a block device to use for power fail
+               testing.
 
         - or add a case to the switch in common/config assigning
           these variables based on the hostname of your test
common/dmlogwrites new file +80 -0

80 lines not on this page · raw message

common/rc +17 -0
index 5ce3322..6a7fc79 100644
@@ -1311,6 +1311,23 @@ _require_dm_flakey()
     fi
 }
 
+# this test requires the device mapper log-writes target
+#
+_require_dm_log_writes()
+{
+	[ -z $LOGWRITES_DEV ] && _notrun "This test requires a logwrites dev"
+	_require_block_device $SCRATCH_DEV
+	_require_block_device $LOGWRITES_DEV
+	_require_command $DMSETUP_PROG
+
+	modprobe dm-log-writes >/dev/null 2>&1
+	$DMSETUP_PROG targets | grep "log-writes" > /dev/null 2>&1
+	if [ $? -ne 0 ]
+	then
+		_notrun "This test requires dm log-writes support"
+	fi
+}
+
 # this test requires the projid32bit feature to be available in mkfs.xfs.
 #
 _require_projid32bit()
ltp/fsx.c +113 -19

256 lines not on this page · raw message

tests/generic/039 new file +99 -0

99 lines not on this page · raw message

tests/generic/039.out new file +2 -0
new file mode 100644
index 0000000..d4e7ef6
@@ -0,0 +1,2 @@
+QA output created by 039
+Silence is golden
tests/generic/group +1 -0
index 1e89848..d3c2059 100644
@@ -41,6 +41,7 @@
 036 auto aio rw stress
 037 metadata auto quick
 038 auto stress
+039 auto log
 053 acl repair auto quick
 062 attr udf auto quick
 068 other auto freeze dangerous stress
Signature · 1 line
1.8.3.1