Provide the correct free block size volume/disk information (#4943)
On *NIX platforms the statfs(2) system call returns a struct containing both the free blocks in the filesystem (Statfs_t.Bfree) and the free blocks available to the unprivileged or non-superuser (Statfs_t.Bavail). The `Bfree` and `Bavail` fields (with `Bfree >= Bavail`) will be set to different values on e.g. filesystems such as ext4 that reserve a certain percentage of the filesystem blocks which may only be allocated by admnistrative privileged processes. The calculations for the `Total` disk space need to subtract the difference between the `Bfree` and `Bavail` fields for it to correctly show the total available storage space available for unprivileged users. This implicitly fixes a bug where the `Used = Total - Free` calculation yielded different (and also incorrect) results for identical contents stored when only the sizes of the disks or backing volumes differed. (as can be witnessed in the `Used:` value displayed in the Minio browser) See: - https://wiki.archlinux.org/index.php/ext4#Reserved_blocks - http://man7.org/linux/man-pages/man2/statfs.2.html - https://man.openbsd.org/statfs - http://lingrok.org/xref/coreutils/src/df.c#893master
parent
d3eb5815d9
commit
0bf981278e
Loading…
Reference in new issue