class BlockDevice {
public:
CephContext* cct;
+ typedef void (*aio_callback_t)(void *handle, void *aio);
private:
std::mutex ioc_reap_lock;
std::vector<IOContext*> ioc_reap_queue;
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);
#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)
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 {
#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")
{
}
#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)