Skip to content

Commit

Permalink
Use fragment size in Linux FileStore size calculation (oshi#1310)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbwiddis authored Jul 27, 2020
1 parent bec41a4 commit fd9e273
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
5.3.0 (in progress)
4.9.3 / 5.2.3 (in progress)
================
* [#1310](https://github.com/oshi/oshi/pull/1310): Use fragment size in Linux FileStore size calculation - [@dbwiddis](https://github.com/dbwiddis).
* Your contribution here

4.9.2 / 5.2.2 (2020-07-20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ private static List<OSFileStore> getFileStoreMatching(String nameToMatch, Map<St
if (0 == LibC.INSTANCE.statvfs(path, vfsStat)) {
totalInodes = vfsStat.f_files.longValue();
freeInodes = vfsStat.f_ffree.longValue();
totalSpace = vfsStat.f_blocks.longValue() * vfsStat.f_bsize.longValue();
usableSpace = vfsStat.f_bavail.longValue() * vfsStat.f_bsize.longValue();
freeSpace = vfsStat.f_bfree.longValue() * vfsStat.f_bsize.longValue();
// Per stavfs, these units are in fragments
totalSpace = vfsStat.f_blocks.longValue() * vfsStat.f_frsize.longValue();
usableSpace = vfsStat.f_bavail.longValue() * vfsStat.f_frsize.longValue();
freeSpace = vfsStat.f_bfree.longValue() * vfsStat.f_frsize.longValue();
} else {
File tmpFile = new File(path);
totalSpace = tmpFile.getTotalSpace();
Expand Down

0 comments on commit fd9e273

Please sign in to comment.