]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
blk/spdk: support both old and new spdk_env_opts member names
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Sat, 30 May 2026 06:11:11 +0000 (14:11 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Sun, 31 May 2026 00:33:08 +0000 (08:33 +0800)
SPDK 21.01 renamed two struct spdk_env_opts members: pci_whitelist ->
pci_allowed and master_core -> main_core. Guard the assignments in
NVMEDevice with SPDK_VERSION.

pci_whitelist -> pci_allowed:  https://github.com/spdk/spdk/commit/4a6a2824119b
master_core -> main_core:      https://github.com/spdk/spdk/commit/fe137c8970bf

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/blk/spdk/NVMEDevice.cc

index 1f1c285ed88b73fb205cc7cd746b45a879f25553..dea2312156c8ebfff5f6750ccdd32b2862b0bc9e 100644 (file)
@@ -31,6 +31,7 @@
 #include <boost/intrusive/slist.hpp>
 
 #include <spdk/nvme.h>
+#include <spdk/version.h>
 
 #include "include/intarith.h"
 #include "include/stringify.h"
@@ -596,14 +597,22 @@ int NVMEManager::try_get(const spdk_nvme_transport_id& trid, SharedDriverData **
         int rc = spdk_pci_addr_parse(&addr, trid.traddr);
         if (!rc) {
           local_pci_device = true;
+#if SPDK_VERSION >= SPDK_VERSION_NUM(21, 1, 0)
+          opts.pci_allowed = &addr;
+#else
           opts.pci_whitelist = &addr;
+#endif
           opts.num_pci_addr = 1;
         }
 
        spdk_env_opts_init(&opts);
         opts.name = "nvme-device-manager";
         opts.core_mask = coremask_arg.c_str();
+#if SPDK_VERSION >= SPDK_VERSION_NUM(21, 1, 0)
+        opts.main_core = m_core_arg;
+#else
         opts.master_core = m_core_arg;
+#endif
         opts.mem_size = mem_size_arg;
         spdk_env_init(&opts);
         spdk_unaffinitize_thread();