]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/NVMEDevice: implement aio_read
authorSage Weil <sage@redhat.com>
Mon, 23 Jan 2017 16:48:10 +0000 (11:48 -0500)
committerSage Weil <sage@redhat.com>
Fri, 27 Jan 2017 15:26:16 +0000 (10:26 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/NVMEDevice.cc
src/os/bluestore/NVMEDevice.h

index fff462cd2c9855230e209d8fa0ab2b8de2d60da3..2f77314223126f4bccfe598c52fe4ed7be97331c 100644 (file)
@@ -942,6 +942,45 @@ int NVMEDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
   return r;
 }
 
+int NVMEDevice::aio_read(
+    uint64_t off,
+    uint64_t len,
+    bufferlist *pbl,
+    IOContext *ioc)
+{
+  uint64_t len = bl.length();
+  dout(20) << __func__ << " " << off << "~" << len << " ioc " << ioc << dendl;
+  assert(off % block_size == 0);
+  assert(len % block_size == 0);
+  assert(len > 0);
+  assert(off < size);
+  assert(off + len <= size);
+
+  Task *t = new Task(this, IOCommand::READ_COMMAND, off, len);
+
+  bufferptr p = buffer::create_page_aligned(len);
+  pbl->append(p);
+  int r = 0;
+  t->ctx = ioc;
+  char *buf = p.c_str();
+  t->fill_cb = [buf, t]() {
+    t->copy_to_buf(buf, 0, t->len);
+  };
+
+  Task *first = static_cast<Task*>(ioc->nvme_task_first);
+  Task *last = static_cast<Task*>(ioc->nvme_task_last);
+  if (last)
+    last->next = t;
+  if (!first)
+    ioc->nvme_task_first = t;
+  ioc->nvme_task_last = t;
+  ++ioc->num_pending;
+
+  return 0;
+}
+
+
+
 int NVMEDevice::read_random(uint64_t off, uint64_t len, char *buf, bool buffered)
 {
   assert(len > 0);
index 9593dd2343d502b2e2a437e52d30bab613c34944..10e3bb2d721e399da4bcb59966fbf083de41dd25 100644 (file)
@@ -225,9 +225,7 @@ class NVMEDevice : public BlockDevice {
     uint64_t off,
     uint64_t len,
     bufferlist *pbl,
-    IOContext *ioc) override {
-    assert(0 == "implement me");
-  }
+    IOContext *ioc) override;
   int aio_write(uint64_t off, bufferlist& bl,
                 IOContext *ioc,
                 bool buffered) override;