assert(0);
}
- IOContext *ioc = ctx;
- NVMEDevice *device = ioc->backend;
+ IOContext *ioc = (IOContext*)ctx;
+ NVMEDevice *device = (NVMEDevice*)ioc->backend;
if (ioc->priv) {
device->aio_callback(device->_callback_priv, ioc->priv);
}
#define dout_prefix *_dout << "bdev(" << name << ") "
NVMEDevice::NVMEDevice(aio_callback_t cb, void *cbpriv)
- : aio_queue(g_conf->bdev_aio_max_queue_depth),
+ : ctrlr(nullptr),
+ ns(nullptr),
aio_stop(false),
aio_thread(this),
aio_callback(cb),
zeros.zero();
}
-int NVMEDevice::_lock()
-{
- struct flock l;
- memset(&l, 0, sizeof(l));
- l.l_type = F_WRLCK;
- l.l_whence = SEEK_SET;
- l.l_start = 0;
- l.l_len = 0;
- int r = ::fcntl(fd_direct, F_SETLK, &l);
- if (r < 0)
- return -errno;
- return 0;
-}
-
int NVMEDevice::open(string p)
{
int r = 0;
- dout(1) << __func__ << " path " << path << dendl;
+ dout(1) << __func__ << " path " << p << dendl;
- nvme_device *dev;
pci_device *pci_dev;
pci_system_init();
continue;
}
- if (sn_tag.compare(sn_tag, serial_number, 16)) {
+ if (sn_tag.compare(serial_number, 16)) {
dout(10) << __func__ << " device serial number not match " << serial_number << dendl;
continue;
}
pci_device_probe(pci_dev);
ctrlr = nvme_attach(pci_dev);
- if (!dev->ctrlr) {
+ if (!ctrlr) {
derr << __func__ << " device attach nvme failed" << dendl;
r = -1;
return r;
dout(1) << __func__ << dendl;
nvme_unregister_io_thread();
_aio_stop();
- path.clear();
+ name.clear();
}
int NVMEDevice::flush()
// since _Static_assert introduced in c11
#define _Static_assert static_assert
+#include "spdk/pci.h"
#include "spdk/nvme.h"
#include "BlockDevice.h"
*/
nvme_controller *ctrlr;
nvme_namespace *ns;
- uint64_t blocklen;
int unbindfromkernel = 0;
string name;
uint64_t block_size;
bool aio_stop;
+ bufferptr zeros;
struct AioCompletionThread : public Thread {
NVMEDevice *bdev;