[PATCH 2/2] btrfs-progs: Add test case to check hole file extents with NO_HOLES flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add test case which we have NO_HOLES incompat flag while still have
hole file extent.

This can be created by enabling NO_HOLES feature on an existing
filesystem, which lowmem mode would cause false alert for it.

Signed-off-by: Qu Wenruo <quwenruo@xxxxxxxxxxxxxx>
---
 tests/fsck-tests/025-file-extents/test.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/fsck-tests/025-file-extents/test.sh b/tests/fsck-tests/025-file-extents/test.sh
index e4bc4247..66cfbaab 100755
--- a/tests/fsck-tests/025-file-extents/test.sh
+++ b/tests/fsck-tests/025-file-extents/test.sh
@@ -5,6 +5,7 @@ source "$TOP/tests/common"
 
 check_prereq btrfs
 check_prereq mkfs.btrfs
+check_prereq btrfstune
 check_global_prereq dd
 check_global_prereq fallocate
 
@@ -38,5 +39,21 @@ test_compressed_inline_extent()
 	run_check "$TOP/btrfs" check "$TEST_DEV"
 }
 
+# Hole file extent with NO_HOLES incompat flag
+# Lowmem mode will cause false alert as it doesn't allow any hole file extent
+# exist, while we can set NO_HOLES at anytime we want, it's definitely a false
+# alert
+test_hole_extent_with_no_holes_flag()
+{
+	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV"
+	run_check_mount_test_dev
+
+	run_check $SUDO_HELPER truncate -s 16K "$TEST_MNT/tmp"
+	run_check_umount_test_dev
+	run_check $SUDO_HELPER "$TOP/btrfstune" -n "$TEST_DEV"
+	run_check "$TOP/btrfs" check "$TEST_DEV"
+}
+
 test_paritical_write_into_prealloc
 test_compressed_inline_extent
+test_hole_extent_with_no_holes_flag
-- 
2.13.1



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux