|
|
26ccd9 |
From fe831b526b88f6ca7a27fdb149b8a7d2ecddbc55 Mon Sep 17 00:00:00 2001
|
|
|
26ccd9 |
From: Santosh Sivaraj <santosh@fossix.org>
|
|
|
26ccd9 |
Date: Thu, 13 May 2021 11:42:18 +0530
|
|
|
26ccd9 |
Subject: [PATCH 021/217] Use page size as alignment value
|
|
|
0670da |
|
|
|
26ccd9 |
The alignment sizes passed to ndctl in the tests are all hardcoded to 4k,
|
|
|
26ccd9 |
the default page size on x86. Change those to the default page size on that
|
|
|
26ccd9 |
architecture (sysconf/getconf). No functional changes otherwise.
|
|
|
0670da |
|
|
|
26ccd9 |
Link: https://lore.kernel.org/r/20210513061218.760322-4-santosh@fossix.org
|
|
|
26ccd9 |
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
|
|
|
26ccd9 |
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
|
|
26ccd9 |
---
|
|
|
26ccd9 |
test/dpa-alloc.c | 15 ++++++++-------
|
|
|
26ccd9 |
test/multi-dax.sh | 6 ++++--
|
|
|
26ccd9 |
test/sector-mode.sh | 4 +++-
|
|
|
26ccd9 |
3 files changed, 15 insertions(+), 10 deletions(-)
|
|
|
0670da |
|
|
|
26ccd9 |
diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c
|
|
|
26ccd9 |
index 0b3bb7a..59185cf 100644
|
|
|
26ccd9 |
--- a/test/dpa-alloc.c
|
|
|
26ccd9 |
+++ b/test/dpa-alloc.c
|
|
|
26ccd9 |
@@ -38,12 +38,13 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
|
|
|
0670da |
struct ndctl_region *region, *blk_region = NULL;
|
|
|
0670da |
struct ndctl_namespace *ndns;
|
|
|
0670da |
struct ndctl_dimm *dimm;
|
|
|
0670da |
- unsigned long size;
|
|
|
0670da |
+ unsigned long size, page_size;
|
|
|
0670da |
struct ndctl_bus *bus;
|
|
|
0670da |
char uuid_str[40];
|
|
|
0670da |
int round;
|
|
|
0670da |
int rc;
|
|
|
0670da |
|
|
|
0670da |
+ page_size = sysconf(_SC_PAGESIZE);
|
|
|
0670da |
/* disable nfit_test.1, not used in this test */
|
|
|
0670da |
bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER1);
|
|
|
0670da |
if (!bus)
|
|
|
26ccd9 |
@@ -124,11 +125,11 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
|
|
|
0670da |
return rc;
|
|
|
0670da |
}
|
|
|
0670da |
ndctl_namespace_disable_invalidate(ndns);
|
|
|
0670da |
- rc = ndctl_namespace_set_size(ndns, SZ_4K);
|
|
|
0670da |
+ rc = ndctl_namespace_set_size(ndns, page_size);
|
|
|
0670da |
if (rc) {
|
|
|
0670da |
- fprintf(stderr, "failed to init %s to size: %d\n",
|
|
|
0670da |
+ fprintf(stderr, "failed to init %s to size: %lu\n",
|
|
|
0670da |
ndctl_namespace_get_devname(ndns),
|
|
|
0670da |
- SZ_4K);
|
|
|
0670da |
+ page_size);
|
|
|
0670da |
return rc;
|
|
|
0670da |
}
|
|
|
0670da |
namespaces[i].ndns = ndns;
|
|
|
26ccd9 |
@@ -150,7 +151,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
|
|
|
0670da |
ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns;
|
|
|
0670da |
if (i % ARRAY_SIZE(namespaces) == 0)
|
|
|
0670da |
round++;
|
|
|
0670da |
- size = SZ_4K * round;
|
|
|
0670da |
+ size = page_size * round;
|
|
|
0670da |
rc = ndctl_namespace_set_size(ndns, size);
|
|
|
0670da |
if (rc) {
|
|
|
0670da |
fprintf(stderr, "%s: set_size: %lx failed: %d\n",
|
|
|
26ccd9 |
@@ -166,7 +167,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
|
|
|
0670da |
i--;
|
|
|
0670da |
round++;
|
|
|
0670da |
ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns;
|
|
|
0670da |
- size = SZ_4K * round;
|
|
|
0670da |
+ size = page_size * round;
|
|
|
0670da |
rc = ndctl_namespace_set_size(ndns, size);
|
|
|
0670da |
if (rc) {
|
|
|
0670da |
fprintf(stderr, "%s failed to update while labels full\n",
|
|
|
26ccd9 |
@@ -175,7 +176,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
|
|
|
0670da |
}
|
|
|
0670da |
|
|
|
0670da |
round--;
|
|
|
0670da |
- size = SZ_4K * round;
|
|
|
0670da |
+ size = page_size * round;
|
|
|
0670da |
rc = ndctl_namespace_set_size(ndns, size);
|
|
|
0670da |
if (rc) {
|
|
|
0670da |
fprintf(stderr, "%s failed to reduce size while labels full\n",
|
|
|
26ccd9 |
diff --git a/test/multi-dax.sh b/test/multi-dax.sh
|
|
|
26ccd9 |
index 8496619..b343a38 100755
|
|
|
26ccd9 |
--- a/test/multi-dax.sh
|
|
|
26ccd9 |
+++ b/test/multi-dax.sh
|
|
|
26ccd9 |
@@ -13,6 +13,8 @@ check_prereq "jq"
|
|
|
0670da |
|
|
|
0670da |
trap 'err $LINENO' ERR
|
|
|
0670da |
|
|
|
0670da |
+ALIGN_SIZE=`getconf PAGESIZE`
|
|
|
0670da |
+
|
|
|
0670da |
# setup (reset nfit_test dimms)
|
|
|
0670da |
modprobe nfit_test
|
|
|
0670da |
$NDCTL disable-region -b $NFIT_TEST_BUS0 all
|
|
|
26ccd9 |
@@ -23,9 +25,9 @@ rc=1
|
|
|
0670da |
query=". | sort_by(.available_size) | reverse | .[0].dev"
|
|
|
0670da |
region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query")
|
|
|
0670da |
|
|
|
0670da |
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
|
|
|
0670da |
+json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a $ALIGN_SIZE -s 16M)
|
|
|
0670da |
chardev1=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev")
|
|
|
0670da |
-json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
|
|
|
0670da |
+json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a $ALIGN_SIZE -s 16M)
|
|
|
0670da |
chardev2=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev")
|
|
|
0670da |
|
|
|
0670da |
_cleanup
|
|
|
26ccd9 |
diff --git a/test/sector-mode.sh b/test/sector-mode.sh
|
|
|
26ccd9 |
index 54fa806..7a2faea 100755
|
|
|
26ccd9 |
--- a/test/sector-mode.sh
|
|
|
26ccd9 |
+++ b/test/sector-mode.sh
|
|
|
26ccd9 |
@@ -11,6 +11,8 @@ check_prereq "jq"
|
|
|
0670da |
set -e
|
|
|
0670da |
trap 'err $LINENO' ERR
|
|
|
0670da |
|
|
|
0670da |
+ALIGN_SIZE=`getconf PAGESIZE`
|
|
|
0670da |
+
|
|
|
0670da |
# setup (reset nfit_test dimms)
|
|
|
0670da |
modprobe nfit_test
|
|
|
0670da |
$NDCTL disable-region -b $NFIT_TEST_BUS0 all
|
|
|
26ccd9 |
@@ -27,7 +29,7 @@ NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query")
|
|
|
0670da |
REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev")
|
|
|
0670da |
echo 0 > /sys/bus/nd/devices/$REGION/read_only
|
|
|
0670da |
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
|
|
|
0670da |
-$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a 4K
|
|
|
0670da |
+$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a $ALIGN_SIZE
|
|
|
0670da |
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
|
|
|
0670da |
|
|
|
0670da |
_cleanup
|
|
|
26ccd9 |
--
|
|
|
26ccd9 |
2.27.0
|
|
|
26ccd9 |
|