]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
NVMEDevice: add default constructor for Task and clean up
authorHaomai Wang <haomai@xsky.com>
Sun, 21 Feb 2016 10:33:24 +0000 (18:33 +0800)
committerHaomai Wang <haomai@xsky.com>
Sun, 21 Feb 2016 10:33:24 +0000 (18:33 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/os/bluestore/NVMEDevice.cc
src/os/bluestore/NVMEDevice.h

index df692cfe03587550dbbfd524a40e6920c3d94eea..c8e2941a8373389caee8e51da9abc9ee2670a7f1 100644 (file)
@@ -747,11 +747,8 @@ int NVMEDevice::aio_write(
   t->offset = off;
   t->len = len;
   t->device = this;
-  t->return_code = 0;
-  t->next = nullptr;
 
   if (buffered) {
-    t->ctx = nullptr;
     // Only need to push the first entry
     driver->queue_task(t);
     Mutex::Locker l(buffer_lock);
@@ -798,8 +795,6 @@ int NVMEDevice::aio_zero(
     t->offset = off;
     t->len = len;
     t->device = this;
-    t->return_code = 0;
-    t->next = nullptr;
 
     t->ctx = ioc;
     Task *first = static_cast<Task*>(ioc->nvme_task_first);
@@ -859,7 +854,6 @@ int NVMEDevice::read(uint64_t off, uint64_t len, bufferlist *pbl,
   t->len = len;
   t->device = this;
   t->return_code = 1;
-  t->next = nullptr;
   ++ioc->num_reading;
   driver->queue_task(t);
 
@@ -920,7 +914,6 @@ int NVMEDevice::read_buffered(uint64_t off, uint64_t len, char *buf)
   t->len = aligned_len;
   t->device = this;
   t->return_code = 1;
-  t->next = nullptr;
   ++ioc.num_reading;
   driver->queue_task(t);
 
index a47962b2165481c6cde5921d83a973b3593a5590..4a7900acba602917c2ec5c20513bda7b57ead142 100644 (file)
@@ -42,13 +42,14 @@ enum class IOCommand {
 class NVMEDevice;
 
 struct Task {
-  NVMEDevice *device;
-  IOContext *ctx;
+  NVMEDevice *device = nullptr;
+  IOContext *ctx = nullptr;
   IOCommand command;
-  uint64_t offset, len;
-  void *buf;
-  Task *next;
-  int64_t return_code;
+  uint64_t offset = 0;
+  uint64_t len = 0;
+  void *buf = nullptr;
+  Task *next = nullptr;
+  int64_t return_code = 0;
   utime_t start;
 };