[PATCH blktests 1/2] nvme/rc: introduce helper functions to check namespace metadata
Shin'ichiro Kawasaki
shinichiro.kawasaki at wdc.com
Sun Jun 15 19:07:15 PDT 2025
To confirm that the TEST_DEV namespace has metadata area for each LBA or
not, introduce the helper function _test_dev_has_metadata(), which
checks the sysfs attribute metadata_bytes.
Also, to confirm that the metadata is not used as the extended LBA,
introduce the helper function _test_dev_disables_extended_lba(), which
checks the NVME_NS_FLBAS_META_EXT flag in the flbas field.
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
tests/nvme/rc | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 9dbd1ce..215a10a 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -153,6 +153,29 @@ _require_test_dev_is_not_nvme_multipath() {
return 0
}
+_test_dev_has_metadata() {
+ if (( ! $(<"${TEST_DEV_SYSFS}/metadata_bytes") )); then
+ SKIP_REASONS+=("$TEST_DEV does not have metadata")
+ return 1
+ fi
+ return 0
+}
+
+_test_dev_disables_extended_lba() {
+ local flbas
+
+ if ! flbas=$(nvme id-ns "$TEST_DEV" | grep flbas | \
+ sed --quiet 's/.*: \(.*\)/\1/p'); then
+ SKIP_REASONS+=("$TEST_DEV does not have namespace flbas field")
+ return 1
+ fi
+ if (( flbas & 0x10 )); then
+ SKIP_REASONS+=("$TEST_DEV enables NVME_NS_FLBAS_META_EXT")
+ return 1
+ fi
+ return 0
+}
+
_require_nvme_test_img_size() {
local require_sz_mb
local nvme_img_size_mb
--
2.49.0
More information about the Linux-nvme
mailing list