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

Fix memstore free space caculation #3451

Merged
merged 1 commit into from Jan 22, 2015

Conversation

xiaoxichen
Copy link
Contributor

Originally if memstore run out of space, it will report a very
large positive number as free space. For example:

root@bigmem:~# rados df
pool name KB objects clones degraded unfound rd rd KB wr wr KB
rbd 12366704 92240 0 0 0 0 0 92240 12366704
total used 12375877 92240
total avail 36028797009199167
total space 2611076

st->f_bavail = st->f_blocks - used_bytes / st->f_bsize

This is due to used_bytes is an unsigned value, so compiler make the whole statement unsigned.

Fix it by adding explicit type cast,

st->f_bavail = long(st->f_blocks) - long(used_bytes / st->f_bsize)

Signed-off-by: Xiaoxi Chen xiaoxi.chen@intel.com

Originally if memstore run out of space, it will report a very
large positive number as free space. For example:

root@bigmem:~# rados df
pool name                 KB      objects       clones     degraded      unfound           rd        rd KB           wr        wr KB
rbd                 12366704        92240            0            0           0            0            0        92240     12366704
  total used        12375877        92240
  total avail   36028797009199167
  total space        2611076

st->f_bavail = st->f_blocks - used_bytes / st->f_bsize

This is due to used_bytes is an unsigned value, so compiler make the whole statement unsigned.

Fix it by adding explicit type cast,

st->f_bavail = long(st->f_blocks) - long(used_bytes / st->f_bsize)

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
@loic-bot
Copy link

SUCCESS: the output of run-make-check.sh on centos-centos7 for fc13c1f is http://paste2.org/7wcsy7Kx

:octocat: Sent from GH.

liewegas added a commit that referenced this pull request Jan 22, 2015
Fix memstore free space caculation

Reviewed-by: Sage Weil <sage@redhat.com>
@liewegas liewegas merged commit 8cc3e17 into ceph:master Jan 22, 2015
@xiaoxichen xiaoxichen deleted the fix_memstore_statfs branch January 28, 2015 06:53
@ghost ghost added the core label Feb 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants