main: rest space computation obeys writeback

This commit is contained in:
Thomas Schoebel-Theuer 2019-08-30 08:54:12 +02:00 committed by Thomas Schoebel-Theuer
parent 87963f672e
commit 2fdc22f780
1 changed files with 10 additions and 2 deletions

View File

@ -412,8 +412,16 @@ int compute_emergency_mode(void)
int mode = 4; int mode = 4;
int this_mode = 0; int this_mode = 0;
mars_remaining_space("/mars", &raw_total_space, &raw_remaining_space); mars_remaining_space("/mars", &raw_total_space, &rest);
rest = raw_remaining_space;
/* Take current writeback memory usage into account.
* Somewhen, it will land on the disk...
*/
rest -= atomic64_read(&global_mshadow_used) / 1024;
if (rest < 0)
rest = 0;
raw_remaining_space = rest;
#define CHECK_LIMIT(LIMIT_VAR) \ #define CHECK_LIMIT(LIMIT_VAR) \
if (LIMIT_VAR > 0) \ if (LIMIT_VAR > 0) \