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

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