diff mbox

[8/9] btrfs-progs: fsck-tests: Add new test case for partly written prealloc extent

Message ID 20170123091359.21390-10-quwenruo@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Qu Wenruo Jan. 23, 2017, 9:13 a.m. UTC
This is a bug found in lowmem mode, which reports false alert for partly
written prealloc extent.

Reported-by: Chris Murphy <chris@colorremedies.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 tests/fsck-tests/020-extent-ref-cases/test.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox

Patch

diff --git a/tests/fsck-tests/020-extent-ref-cases/test.sh b/tests/fsck-tests/020-extent-ref-cases/test.sh
index 5dc5e55d..91340671 100755
--- a/tests/fsck-tests/020-extent-ref-cases/test.sh
+++ b/tests/fsck-tests/020-extent-ref-cases/test.sh
@@ -18,6 +18,7 @@ 
 source $TOP/tests/common
 
 check_prereq btrfs
+check_global_prereq xfs_io
 
 for img in *.img *.raw.xz
 do
@@ -28,3 +29,17 @@  do
 	run_check $TOP/btrfs check "$image"
 	rm -f "$image"
 done
+
+# Extra test case for partly written prealloc extents.
+test_prealloc_written()
+{
+	run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $TEST_DEV
+
+	run_check_mount_test_dev
+	xfs_io -f -c "falloc 0 128k" -c "syncfs" $TEST_MNT/tmpfile
+	xfs_io -c "pwrite 0 64k" $TEST_MNT/tmpfile
+
+	run_check_umount_test_dev
+
+	run_check $TOP/btrfs check $TEST_DEV
+}