Skip to content

Commit

Permalink
Merge pull request #10795 from liewegas/wip-bluestore-statfs
Browse files Browse the repository at this point in the history
os/bluestore: include bluefs space in statfs result

Reviewed-by: Varada Kari <varada.kari@sandisk.com>
  • Loading branch information
liewegas committed Aug 22, 2016
2 parents 1a23c2e + b97f3d6 commit aac733d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -3412,15 +3412,20 @@ void BlueStore::_sync()

int BlueStore::statfs(struct store_statfs_t *buf)
{
uint64_t bluefs_len = 0;
for (interval_set<uint64_t>::iterator p = bluefs_extents.begin();
p != bluefs_extents.end(); p++)
bluefs_len += p.get_len();

buf->reset();
buf->total = bdev->get_size();
assert(alloc->get_free() >= bluefs_len);
buf->available = (alloc->get_free() - bluefs_len);
buf->available = alloc->get_free();

if (bluefs) {
// part of our shared device is "free" accordingly to BlueFS
buf->available += bluefs->get_free(bluefs_shared_bdev);

// include dedicated db, too, if that isn't the shared device.
if (bluefs_shared_bdev != BlueFS::BDEV_DB) {
buf->available += bluefs->get_free(BlueFS::BDEV_DB);
buf->total += bluefs->get_total(BlueFS::BDEV_DB);
}
}

bufferlist bl;
int r = db->get(PREFIX_STAT, "bluestore_statfs", &bl);
Expand Down

0 comments on commit aac733d

Please sign in to comment.