We actually compute kb_used as the kb - kb_avail. We don't have the
statfs() system call issue of non-privileged f_bavail vs f_bfree. It
was assumed that used was really like (blocks - f_bfree). It is not.
Signed-off-by: David Zafman <dzafman@redhat.com>
{
Mutex::Locker l(full_status_lock);
- // We base ratio on kb_avail rather than kb_used because they can
- // differ significantly e.g. on btrfs volumes with a large number of
- // chunks reserved for metadata, and for our purposes (avoiding
- // completely filling the disk) it's far more important to know how
- // much space is available to use than how much we've already used.
- float ratio = ((float)(osd_stat.kb - osd_stat.kb_avail)) /
- ((float)osd_stat.kb);
+ float ratio = ((float)osd_stat.kb_used) / ((float)osd_stat.kb);
cur_ratio = ratio;
// The OSDMap ratios take precendence. So if the failsafe is .95 and