Use f_bavail to calculate free space
Failures are seen on devices with Linux 3.10. And they are mainly due to this change: https://lwn.net/Articles/546473/ The blocks reserved in this change is not the same thing as what we think are reserved for common usage of root user. And this part is included in free blocks but not in available blocks. Change-Id: Ib29e12d775b86ef657c0af7fa7a944d2b1e12dc8
This commit is contained in:
parent
aa4df5c45b
commit
3b4977638f
1 changed files with 1 additions and 1 deletions
|
@ -662,7 +662,7 @@ size_t FreeSpaceForFile(const char* filename) {
|
||||||
printf("failed to statfs %s: %s\n", filename, strerror(errno));
|
printf("failed to statfs %s: %s\n", filename, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return sf.f_bsize * sf.f_bfree;
|
return sf.f_bsize * sf.f_bavail;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CacheSizeCheck(size_t bytes) {
|
int CacheSizeCheck(size_t bytes) {
|
||||||
|
|
Loading…
Reference in a new issue