Blame SOURCES/0072-ndctl-test-Initialize-the-label-area-by-default.patch

e0018b
From fe37c85f1ffb0b2d04ef60e8ece6a9a44a145cc5 Mon Sep 17 00:00:00 2001
e0018b
From: Dan Williams <dan.j.williams@intel.com>
e0018b
Date: Wed, 5 Jan 2022 13:32:00 -0800
e0018b
Subject: [PATCH 072/217] ndctl/test: Initialize the label area by default
e0018b
e0018b
The removal of BLK-mode support causes nfit_test regions to not be
e0018b
'aliased' by default, which means that the only way to enable labels is to
e0018b
initialize the namespace label index block. In support of that the common
e0018b
'reset()' helper is updated to initialize v1.1 labels instead of zero them.
e0018b
Additionally, it highlighted that some btt tests have silent assumptions of
e0018b
v1.1 vs v1.2 label support. Add a 'resetV()' alternative to the common
e0018b
'reset()' function that initializes the label area to v1.2.
e0018b
e0018b
Link: https://lore.kernel.org/r/164141832017.3990253.10383328274835531066.stgit@dwillia2-desk3.amr.corp.intel.com
e0018b
Tested-by: Alison Schofield <alison.schofield@intel.com>
e0018b
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
e0018b
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
---
e0018b
 test/btt-errors.sh     |  4 ++--
e0018b
 test/btt-pad-compat.sh |  2 +-
e0018b
 test/common            | 11 +++++++++--
e0018b
 test/label-compat.sh   |  2 +-
e0018b
 4 files changed, 13 insertions(+), 6 deletions(-)
e0018b
e0018b
diff --git a/test/btt-errors.sh b/test/btt-errors.sh
e0018b
index 5a20d26..6e69178 100755
e0018b
--- a/test/btt-errors.sh
e0018b
+++ b/test/btt-errors.sh
e0018b
@@ -45,7 +45,7 @@ trap 'err $LINENO cleanup' ERR
e0018b
 
e0018b
 # setup (reset nfit_test dimms)
e0018b
 modprobe nfit_test
e0018b
-reset
e0018b
+resetV
e0018b
 
e0018b
 rc=1
e0018b
 
e0018b
@@ -124,7 +124,7 @@ dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1
e0018b
 
e0018b
 # reset everything to get a clean log
e0018b
 if grep -q "$MNT" /proc/mounts; then umount $MNT; fi
e0018b
-reset
e0018b
+resetV
e0018b
 dev="x"
e0018b
 json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
e0018b
 eval "$(echo "$json" | json2var)"
e0018b
diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
e0018b
index be538b7..005316a 100755
e0018b
--- a/test/btt-pad-compat.sh
e0018b
+++ b/test/btt-pad-compat.sh
e0018b
@@ -148,7 +148,7 @@ do_tests()
e0018b
 	verify_idx 0 1
e0018b
 
e0018b
 	# do the same with an old format namespace
e0018b
-	reset
e0018b
+	resetV
e0018b
 	create_oldfmt_ns
e0018b
 	verify_idx 0 2
e0018b
 
e0018b
diff --git a/test/common b/test/common
e0018b
index 3c54d63..b6d4712 100644
e0018b
--- a/test/common
e0018b
+++ b/test/common
e0018b
@@ -49,14 +49,21 @@ err()
e0018b
 reset()
e0018b
 {
e0018b
 	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
e0018b
-	$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
e0018b
+	$NDCTL init-labels -f -b $NFIT_TEST_BUS0 all
e0018b
+	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
e0018b
+}
e0018b
+
e0018b
+resetV()
e0018b
+{
e0018b
+	$NDCTL disable-region -b $NFIT_TEST_BUS0 all
e0018b
+	$NDCTL init-labels -f -V 1.2 -b $NFIT_TEST_BUS0 all
e0018b
 	$NDCTL enable-region -b $NFIT_TEST_BUS0 all
e0018b
 }
e0018b
 
e0018b
 reset1()
e0018b
 {
e0018b
 	$NDCTL disable-region -b $NFIT_TEST_BUS1 all
e0018b
-	$NDCTL zero-labels -b $NFIT_TEST_BUS1 all
e0018b
+	$NDCTL init-labels -f -b $NFIT_TEST_BUS1 all
e0018b
 	$NDCTL enable-region -b $NFIT_TEST_BUS1 all
e0018b
 }
e0018b
 
e0018b
diff --git a/test/label-compat.sh b/test/label-compat.sh
e0018b
index 8ab2858..7ae4d5e 100755
e0018b
--- a/test/label-compat.sh
e0018b
+++ b/test/label-compat.sh
e0018b
@@ -17,7 +17,7 @@ trap 'err $LINENO' ERR
e0018b
 # setup (reset nfit_test dimms)
e0018b
 modprobe nfit_test
e0018b
 $NDCTL disable-region -b $NFIT_TEST_BUS0 all
e0018b
-$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
e0018b
+$NDCTL init-labels -f -b $NFIT_TEST_BUS0 all
e0018b
 
e0018b
 # grab the largest pmem region on -b $NFIT_TEST_BUS0
e0018b
 query=". | sort_by(.available_size) | reverse | .[0].dev"
e0018b
-- 
e0018b
2.27.0
e0018b