assert(r != -ENOENT);
return r;
}
- buf0->total = buf.f_blocks * buf.f_bsize;
- buf0->available = buf.f_bavail * buf.f_bsize;
+
+ uint64_t bfree = buf.f_bavail * buf.f_bsize;
+ uint64_t thin_total, thin_avail;
+ if (get_vdo_utilization(vdo_fd, &thin_total, &thin_avail)) {
+ buf0->total = thin_total;
+ bfree = std::min(bfree, thin_avail);
+ } else {
+ buf0->total = buf.f_blocks * buf.f_bsize;
+ }
+ buf0->available = bfree;
+
// Adjust for writes pending in the journal
if (journal) {
uint64_t estimate = journal->get_journal_size_estimate();
return r;
}
+ // vdo
+ {
+ char partition_path[PATH_MAX];
+ char dev_node[PATH_MAX];
+ int rc = get_device_by_fd(fsid_fd, partition_path, dev_node, PATH_MAX);
+ if (rc == 0) {
+ vdo_fd = get_vdo_stats_handle(dev_node, &vdo_name);
+ if (vdo_fd >= 0) {
+ dout(0) << __func__ << " VDO volume " << vdo_name << " for " << dev_node
+ << dendl;
+ }
+ }
+ }
+
// test xattrs
char fn[PATH_MAX];
int x = rand();
(*it)->stop();
}
+ if (vdo_fd >= 0) {
+ VOID_TEMP_FAILURE_RETRY(::close(vdo_fd));
+ vdo_fd = -1;
+ }
if (fsid_fd >= 0) {
VOID_TEMP_FAILURE_RETRY(::close(fsid_fd));
fsid_fd = -1;