From: Haomai Wang Date: Sun, 21 Feb 2016 10:33:24 +0000 (+0800) Subject: NVMEDevice: add default constructor for Task and clean up X-Git-Tag: v10.1.0~347^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=feaa4573366cce27b5523d2838ca09708c4c0b35;p=ceph.git NVMEDevice: add default constructor for Task and clean up Signed-off-by: Haomai Wang --- diff --git a/src/os/bluestore/NVMEDevice.cc b/src/os/bluestore/NVMEDevice.cc index df692cfe0358..c8e2941a8373 100644 --- a/src/os/bluestore/NVMEDevice.cc +++ b/src/os/bluestore/NVMEDevice.cc @@ -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(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); diff --git a/src/os/bluestore/NVMEDevice.h b/src/os/bluestore/NVMEDevice.h index a47962b21654..4a7900acba60 100644 --- a/src/os/bluestore/NVMEDevice.h +++ b/src/os/bluestore/NVMEDevice.h @@ -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; };