public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic/466: be more precise about which block sizes to use
@ 2017-12-11 17:27 Theodore Ts'o
  2017-12-13 17:36 ` Darrick J. Wong
  0 siblings, 1 reply; 7+ messages in thread
From: Theodore Ts'o @ 2017-12-11 17:27 UTC (permalink / raw)
  To: fstests; +Cc: darrick.wong, Theodore Ts'o

The test previously blindly tried block sizes from 512 to 65536 and
relied on mkfs to fail.  This is problematic for a number of file
systems.  For example, when testing btrfs, _scratch_mkfs_sized simply
ignores the blocksize, so the test will pointlessly run the same test
multiple times.  For ext4, when encryption is enabled, the only block
size which is supported is the page size.

So define two new functions _fs_min_blocksize and _fs_max_blocksize,
and use it so that generic/466 will only try using the block sizes
that will work.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 common/rc         | 23 +++++++++++++++++++++++
 tests/generic/466 |  6 +++++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index 59d4b961..7aa747ad 100644
--- a/common/rc
+++ b/common/rc
@@ -1067,6 +1067,29 @@ _scratch_mkfs_blocksized()
     esac
 }
 
+_fs_min_blocksize()
+{
+    case $FSTYP in
+    ext4)
+	if echo "$MOUNT_OPTIONS" | grep -q "test_dummy_encryption"; then
+	    get_page_size
+	else
+            echo 1024
+	fi
+       ;;
+    btrfs)
+	get_page_size
+	;;
+    *)
+	echo 512
+    esac
+}
+
+_fs_max_blocksize()
+{
+    get_page_size
+}
+
 _scratch_resvblks()
 {
 	case $FSTYP in
diff --git a/tests/generic/466 b/tests/generic/466
index 07f24a74..a1d944d3 100755
--- a/tests/generic/466
+++ b/tests/generic/466
@@ -54,7 +54,11 @@ unset MKFS_OPTIONS
 
 echo "Starting test" > $seqres.full
 devsize=$(blockdev --getsize64 $SCRATCH_DEV)
-for blocksize in 512 1024 2048 4096 8192 16384 32768 65536; do
+min_blocksize=$(_fs_min_blocksize)
+max_blocksize=$(_fs_max_blocksize)
+
+for (( blocksize = min_blocksize ; blocksize <= max_blocksize ;
+       blocksize = blocksize * 2)); do
 	echo "+ Format blocksize $blocksize and mount" >> $seqres.full
 	_scratch_unmount > /dev/null 2>&1
 	# Try to format and mount with the given blocksize.  If they don't
-- 
2.11.0.rc0.7.gbe5a750


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-01-07 15:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-11 17:27 [PATCH] generic/466: be more precise about which block sizes to use Theodore Ts'o
2017-12-13 17:36 ` Darrick J. Wong
2017-12-31 18:45   ` Theodore Ts'o
2018-01-02 20:36     ` Darrick J. Wong
2018-01-05  2:12       ` Darrick J. Wong
2018-01-05  3:28         ` Theodore Ts'o
2018-01-07 15:24           ` Eryu Guan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox