From: mychoxin Date: Sat, 12 Aug 2017 08:25:28 +0000 (+0800) Subject: os/bluestore: move aio_callback and aio_callback_priv to class BlockDevice X-Git-Tag: v13.0.0~79^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a3b27da52e7cd36982fb54260fe6f08215e7961d;p=ceph.git os/bluestore: move aio_callback and aio_callback_priv to class BlockDevice Signed-off-by: mychoxin --- diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index 45e4df8c530..0014c686320 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -82,6 +82,7 @@ public: class BlockDevice { public: CephContext* cct; + typedef void (*aio_callback_t)(void *handle, void *aio); private: std::mutex ioc_reap_lock; std::vector ioc_reap_queue; @@ -91,15 +92,18 @@ protected: uint64_t size; uint64_t block_size; bool rotational = true; + aio_callback_t aio_callback; + void *aio_callback_priv; public: - BlockDevice(CephContext* cct) + BlockDevice(CephContext* cct, aio_callback_t cb, void *cbpriv) : cct(cct), size(0), - block_size(0) + block_size(0), + aio_callback(cb), + aio_callback_priv(cbpriv) {} virtual ~BlockDevice() = default; - typedef void (*aio_callback_t)(void *handle, void *aio); static BlockDevice *create( CephContext* cct, const std::string& path, aio_callback_t cb, void *cbpriv); diff --git a/src/os/bluestore/KernelDevice.cc b/src/os/bluestore/KernelDevice.cc index b1e9126326a..b0a4cde589c 100644 --- a/src/os/bluestore/KernelDevice.cc +++ b/src/os/bluestore/KernelDevice.cc @@ -34,14 +34,12 @@ #define dout_prefix *_dout << "bdev(" << this << " " << path << ") " KernelDevice::KernelDevice(CephContext* cct, aio_callback_t cb, void *cbpriv) - : BlockDevice(cct), + : BlockDevice(cct, cb, cbpriv), fd_direct(-1), fd_buffered(-1), fs(NULL), aio(false), dio(false), debug_lock("KernelDevice::debug_lock"), aio_queue(cct->_conf->bdev_aio_max_queue_depth), - aio_callback(cb), - aio_callback_priv(cbpriv), aio_stop(false), aio_thread(this), injecting_crash(0) diff --git a/src/os/bluestore/KernelDevice.h b/src/os/bluestore/KernelDevice.h index 9999ea282a2..26e9c9a0519 100644 --- a/src/os/bluestore/KernelDevice.h +++ b/src/os/bluestore/KernelDevice.h @@ -36,8 +36,6 @@ class KernelDevice : public BlockDevice { std::mutex flush_mutex; aio_queue_t aio_queue; - aio_callback_t aio_callback; - void *aio_callback_priv; bool aio_stop; struct AioCompletionThread : public Thread { diff --git a/src/os/bluestore/NVMEDevice.cc b/src/os/bluestore/NVMEDevice.cc index c30ecf61b6d..6c791dbf997 100644 --- a/src/os/bluestore/NVMEDevice.cc +++ b/src/os/bluestore/NVMEDevice.cc @@ -855,12 +855,10 @@ void io_complete(void *t, const struct spdk_nvme_cpl *completion) #define dout_prefix *_dout << "bdev(" << name << ") " NVMEDevice::NVMEDevice(CephContext* cct, aio_callback_t cb, void *cbpriv) - : BlockDevice(cct), + : BlockDevice(cct, cb, cbpriv), driver(nullptr), aio_stop(false), - buffer_lock("NVMEDevice::buffer_lock"), - aio_callback(cb), - aio_callback_priv(cbpriv) + buffer_lock("NVMEDevice::buffer_lock") { } diff --git a/src/os/bluestore/PMEMDevice.cc b/src/os/bluestore/PMEMDevice.cc index b86ddc080b2..517870162a6 100644 --- a/src/os/bluestore/PMEMDevice.cc +++ b/src/os/bluestore/PMEMDevice.cc @@ -34,7 +34,7 @@ #define dout_prefix *_dout << "bdev-PMEM(" << path << ") " PMEMDevice::PMEMDevice(CephContext *cct, aio_callback_t cb, void *cbpriv) - : BlockDevice(cct), + : BlockDevice(cct, cb, cbpriv), fd(-1), addr(0), debug_lock("PMEMDevice::debug_lock"), injecting_crash(0)