#include <fcntl.h>
#include <unistd.h>
#include <map>
+#ifdef HAVE_SSE
+#include <xmmintrin.h>
+#endif
#include <rte_config.h>
#include <rte_cycles.h>
static void io_complete(void *t, const struct nvme_completion *completion) {
Task *task = static_cast<Task*>(t);
IOContext *ctx = task->ctx;
+ task->device->inflight_ops.dec();
if (task->command == IOCommand::WRITE_COMMAND) {
auto left = ctx->num_running.dec();
assert(!nvme_completion_is_error(completion));
pci_device_iterator *iter = pci_id_match_iterator_create(&match);
char serial_number[128];
- const struct nvme_controller_data *cdata;
while ((pci_dev = pci_device_next(iter)) != NULL) {
dout(10) << __func__ << " found device at "<< pci_dev->bus << ":" << pci_dev->dev << ":"
<< pci_dev->func << " vendor:0x" << pci_dev->vendor_id << " device:0x" << pci_dev->device_id
aio_stop(false),
queue_lock("NVMEDevice::queue_lock"),
aio_thread(this),
+ inflight_ops(0),
aio_callback(cb),
aio_callback_priv(cbpriv)
{
derr << __func__ << " failed to do write command" << dendl;
assert(0);
}
+ inflight_ops.inc();
t = t->prev;
}
break;
Mutex::Locker l(t->ctx->lock);
t->ctx->cond.Signal();
}
+ inflight_ops.inc();
break;
}
case IOCommand::FLUSH_COMMAND:
Mutex::Locker l(t->ctx->lock);
t->ctx->cond.Signal();
}
+ inflight_ops.inc();
break;
}
}
+ } else if (!inflight_ops.read()) {
+ dout(20) << __func__ << " idle, have a pause" << dendl;
+#ifdef HAVE_SSE
+ _mm_pause();
+#else
+ usleep(10);
+#endif
}
nvme_ctrlr_process_io_completions(ctrlr, max);