From: Kefu Chai Date: Wed, 3 Feb 2016 10:27:18 +0000 (+0800) Subject: NVMEDevice: fix the build error with latest spdk X-Git-Tag: v10.0.4~45^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ff56154620cee7221d9f66a61cd61d813d449c79;p=ceph.git NVMEDevice: fix the build error with latest spdk * include spdk headers in source file * declare const string with "const" specifier * pass flag to nvme_ns_cmd_{write,read}() Signed-off-by: Kefu Chai --- diff --git a/src/os/bluestore/NVMEDevice.cc b/src/os/bluestore/NVMEDevice.cc index 9d0eb63a6038..ca143db83de0 100644 --- a/src/os/bluestore/NVMEDevice.cc +++ b/src/os/bluestore/NVMEDevice.cc @@ -25,6 +25,17 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifdef __cplusplus +} +#endif + #include #include #include @@ -64,7 +75,7 @@ enum { static void io_complete(void *t, const struct nvme_completion *completion); -static char *ealargs[] = { +static const char *ealargs[] = { "ceph-osd", "-c 0x1", /* This must be the second parameter. It is overwritten by index in main(). */ "-n 4", @@ -256,7 +267,7 @@ void SharedDriverData::_aio_thread() lba_off = t->offset / block_size; lba_count = t->len / block_size; dout(20) << __func__ << " write command issued " << lba_off << "~" << lba_count << dendl; - r = nvme_ns_cmd_write(ns, t->buf, lba_off, lba_count, io_complete, t); + r = nvme_ns_cmd_write(ns, t->buf, lba_off, lba_count, io_complete, t, 0); if (r < 0) { t->ctx->nvme_task_first = t->ctx->nvme_task_last = nullptr; rte_free(t->buf); @@ -276,7 +287,7 @@ void SharedDriverData::_aio_thread() dout(20) << __func__ << " read command issueed " << lba_off << "~" << lba_count << dendl; lba_off = t->offset / block_size; lba_count = t->len / block_size; - r = nvme_ns_cmd_read(ns, t->buf, lba_off, lba_count, io_complete, t); + r = nvme_ns_cmd_read(ns, t->buf, lba_off, lba_count, io_complete, t, 0); if (r < 0) { derr << __func__ << " failed to read" << dendl; t->ctx->num_reading.dec(); @@ -384,7 +395,7 @@ int NVMEManager::_scan_nvme_device(const string &sn_tag, string &name, nvme_cont pci_device_probe(pci_dev); name = pci_device_get_device_name(pci_dev) ? pci_device_get_device_name(pci_dev) : "Unknown"; if (pci_device_has_kernel_driver(pci_dev)) { - if (!pci_device_has_uio_driver(pci_dev)) { + if (pci_device_has_non_uio_driver(pci_dev)) { /*NVMe kernel driver case*/ if (g_conf->bdev_nvme_unbind_from_kernel) { r = pci_device_switch_to_uio_driver(pci_dev); @@ -401,7 +412,7 @@ int NVMEManager::_scan_nvme_device(const string &sn_tag, string &name, nvme_cont } } } else { - r = pci_device_bind_uio_driver(pci_dev, PCI_UIO_DRIVER); + r = pci_device_bind_uio_driver(pci_dev, const_cast(PCI_UIO_DRIVER)); if (r < 0) { derr << __func__ << " device " << name << " " << pci_dev->bus << ":" << pci_dev->dev << ":" << pci_dev->func diff --git a/src/os/bluestore/NVMEDevice.h b/src/os/bluestore/NVMEDevice.h index cbeb874a386d..dca5837a565e 100644 --- a/src/os/bluestore/NVMEDevice.h +++ b/src/os/bluestore/NVMEDevice.h @@ -25,16 +25,6 @@ // since _Static_assert introduced in c11 #define _Static_assert static_assert -#ifdef __cplusplus -extern "C" { -#endif - -#include "spdk/pci.h" -#include "spdk/nvme.h" - -#ifdef __cplusplus -} -#endif #include "include/atomic.h" #include "include/interval_set.h"