]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common: split _get_hugepagesize into detection and actual query
authorDarrick J. Wong <djwong@kernel.org>
Tue, 29 Aug 2023 23:03:37 +0000 (16:03 -0700)
committerZorro Lang <zlang@kernel.org>
Sat, 2 Sep 2023 05:54:38 +0000 (13:54 +0800)
This helper has two parts -- querying the value, and _notrun'ing the
test if huge pages aren't turned on.  Break these into the usual
_require_hugepages and _get_hugepagesize predicates so that we can adapt
xfs/559 to large folios being used for writes.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc
tests/generic/413
tests/generic/605

index 68d2ad041e88e875edb8da9ffc7360e1d0b440bf..b5bf3c3bcb477ab6a6cb1f095e5a2bee1dad5d3c 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -108,14 +108,17 @@ _get_filesize()
     stat -c %s "$1"
 }
 
+# Does this kernel support huge pages?
+_require_hugepages()
+{
+       awk '/Hugepagesize/ {print $2}' /proc/meminfo | grep -E -q ^[0-9]+$ || \
+               _notrun "Kernel does not report huge page size"
+}
+
 # Get hugepagesize in bytes
 _get_hugepagesize()
 {
-       local hugepgsz=$(awk '/Hugepagesize/ {print $2}' /proc/meminfo)
-       # Call _notrun if $hugepgsz is not a number
-       echo "$hugepgsz" | grep -E -q ^[0-9]+$ || \
-               _notrun "Cannot get the value of Hugepagesize"
-       echo $((hugepgsz * 1024))
+       awk '/Hugepagesize/ {print $2 * 1024}' /proc/meminfo
 }
 
 _mount()
index 155f397d1d4b234d1ac1a13e76d2b4120a47dc86..bd1b04a6248707f7502946adbed1940f91e585ac 100755 (executable)
@@ -13,6 +13,7 @@ _begin_fstest auto quick dax prealloc
 . ./common/filter
 
 _supported_fs generic
+_require_hugepages
 _require_test
 _require_scratch_dax_mountopt "dax"
 _require_test_program "feature"
index 77671f39d3ec46f0fe83e885439c16f676cb12bb..7e814d5ba1dba8ab551006960126a08969687921 100755 (executable)
@@ -13,6 +13,7 @@ _begin_fstest auto attr quick dax prealloc
 . ./common/filter
 
 _supported_fs generic
+_require_hugepages
 _require_scratch_dax_mountopt "dax=always"
 _require_test_program "feature"
 _require_test_program "t_mmap_dio"