[PATCH blktest] blktests: add nvmet memory backend support

Shinichiro Kawasaki shinichiro.kawasaki at wdc.com
Fri Nov 7 03:41:00 PST 2025


On Nov 04, 2025 / 00:14, Chaitanya Kulkarni wrote:
> Add support for testing nvmet memory backend across all transport
> types. This allows tests using _set_combined_conditions with
> _set_nvmet_blkdev_type to automatically test memory backend alongside
> device and file backends.
> 
> The memory backend provides RAM-based volatile storage for NVMe
> namespaces, useful for high-performance testing without disk I/O.
> 
> - Add "mem" to NVMET_BLKDEV_TYPES default value
> - Add _require_nvme_mem_backend() prerequisite check
> - Add _create_nvmet_ns_mem() helper for memory namespace creation
> - Modify _nvmet_target_setup() to handle memory backend type
> 
> All existing tests that support multiple backends (device, file) will
> now automatically run with memory backend as well, providing 3x test
> coverage: device, file, and mem backends across loop, tcp, and rdma
> transports.

Thanks for the patch. I took a look in it, and has three comments below.

1) I ran nvme/006 with the patch on the kernel v6.18-rc4. The kernel did not
   have your patches for memory backend. Then it should be skippped for memory
   backend, but it was not skipped, and caused a failure. I found that the
   helper _require_nvme_mem_backend() is not called from anywhere.

   I suggest the change like [1] to do the check in _set_nvmet_blkdev_type().
   This way, memory backend can be skipped when the kernel does not support it.

2) The section of NVMET_BLKDEV_TYPES in Documentation/running-tests.md needs
   update.

3) It looks that the kernel side change needs some more discussion. When the
   kernel side change get settled, I will take another round of look for this
   blktests side change.


[1]

diff --git a/common/nvme b/common/nvme
index a558943..b08376a 100644
--- a/common/nvme
+++ b/common/nvme
@@ -62,19 +62,17 @@ _require_nvme_trtype_is_fabrics() {
 	return 0
 }
 
-_require_nvme_mem_backend() {
+_has_nvme_mem_backend() {
 	# Check if memory backend is supported in kernel
 	local test_subsys="${NVMET_CFS}/subsystems/blktests-mem-test-$$"
 	local test_ns="${test_subsys}/namespaces/1"
 
 	if ! mkdir -p "${test_subsys}" 2>/dev/null; then
-		SKIP_REASONS+=("cannot create test subsystem in configfs")
 		return 1
 	fi
 
 	if ! mkdir -p "${test_ns}" 2>/dev/null; then
 		rmdir "${test_subsys}"
-		SKIP_REASONS+=("cannot create test namespace in configfs")
 		return 1
 	fi
 
@@ -82,7 +80,6 @@ _require_nvme_mem_backend() {
 	if ! echo "1073741824" > "${test_ns}/mem_size" 2>/dev/null; then
 		rmdir "${test_ns}"
 		rmdir "${test_subsys}"
-		SKIP_REASONS+=("nvmet memory backend not supported")
 		return 1
 	fi
 
diff --git a/tests/nvme/rc b/tests/nvme/rc
index a8f80d8..92cefe6 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -42,8 +42,14 @@ _set_nvme_trtype() {
 _set_nvmet_blkdev_type() {
 	local index=$1
 	local -a types
+	local t
 
-	read -r -a types <<< "$NVMET_BLKDEV_TYPES"
+	for t in "${NVMET_BLKDEV_TYPES[@]}"; do
+		if [[ $t == mem || $t == memory ]]; then
+			_has_nvme_mem_backend || continue
+		fi
+		types+=("$t")
+	done
 
 	if [[ -z $index ]]; then
 		echo ${#types[@]}


More information about the Linux-nvme mailing list