dout(20) << __func__ << " devname " << devname << dendl;
rotational = block_device_is_rotational(devname);
this->devname = devname;
+
+ _detect_vdo();
}
}
delete fs;
fs = NULL;
+ if (vdo_fd >= 0) {
+ VOID_TEMP_FAILURE_RETRY(::close(vdo_fd));
+ vdo_fd = -1;
+ }
+
assert(fd_direct >= 0);
VOID_TEMP_FAILURE_RETRY(::close(fd_direct));
fd_direct = -1;
return 0;
}
+void KernelDevice::_detect_vdo()
+{
+ vdo_fd = get_vdo_stats_handle(devname.c_str(), &vdo_name);
+ if (vdo_fd >= 0) {
+ dout(1) << __func__ << " VDO volume " << vdo_name
+ << " maps to " << devname << dendl;
+ } else {
+ dout(20) << __func__ << " no VDO volume maps to " << devname << dendl;
+ }
+ return;
+}
+
+bool KernelDevice::get_thin_utilization(uint64_t *total, uint64_t *avail) const
+{
+ if (vdo_fd < 0) {
+ return false;
+ }
+ return get_vdo_utilization(vdo_fd, total, avail);
+}
+
int KernelDevice::flush()
{
// protect flush with a mutex. note that we are not really protecting
FS *fs;
bool aio, dio;
+ int vdo_fd = -1; ///< fd for vdo sysfs directory
+ string vdo_name;
+
std::string devname; ///< kernel dev name (/sys/block/$devname), if any
Mutex debug_lock;
void debug_aio_link(aio_t& aio);
void debug_aio_unlink(aio_t& aio);
+ void _detect_vdo();
+
public:
KernelDevice(CephContext* cct, aio_callback_t cb, void *cbpriv);
}
int get_devices(std::set<std::string> *ls) override;
+ bool get_thin_utilization(uint64_t *total, uint64_t *avail) const override;
+
int read(uint64_t off, uint64_t len, bufferlist *pbl,
IOContext *ioc,
bool buffered) override;