Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/bluestore: prevent statfs available from going negative #20487

Merged
merged 2 commits into from Feb 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -6396,14 +6396,13 @@ int BlueStore::statfs(struct store_statfs_t *buf)
buf->available = alloc->get_free();

if (bluefs) {
// part of our shared device is "free" according to BlueFS
// Don't include bluestore_bluefs_min because that space can't
// be used for any other purpose.
buf->available += bluefs->get_free(bluefs_shared_bdev) - cct->_conf->bluestore_bluefs_min;

// include dedicated db, too, if that isn't the shared device.
if (bluefs_shared_bdev != BlueFS::BDEV_DB) {
buf->total += bluefs->get_total(BlueFS::BDEV_DB);
// part of our shared device is "free" according to BlueFS, but we
// can't touch bluestore_bluefs_min of it.
int64_t shared_available = std::min(
bluefs->get_free(bluefs_shared_bdev),
bluefs->get_total(bluefs_shared_bdev) - cct->_conf->bluestore_bluefs_min);
if (shared_available > 0) {
buf->available += shared_available;
}
}

Expand Down