From 937052b231259a47d881d539ad5748245ef55b99 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Fri, 3 Jun 2022 08:55:20 +0200 Subject: New upstream version 3.2.1 --- linux/Platform.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'linux/Platform.c') diff --git a/linux/Platform.c b/linux/Platform.c index 775f9ae..38b66e8 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -358,8 +358,13 @@ void Platform_setMemoryValues(Meter* this) { this->values[4] = pl->availableMem; if (lpl->zfs.enabled != 0 && !Running_containerized) { - this->values[0] -= lpl->zfs.size; - this->values[3] += lpl->zfs.size; + // ZFS does not shrink below the value of zfs_arc_min. + unsigned long long int shrinkableSize = 0; + if (lpl->zfs.size > lpl->zfs.min) + shrinkableSize = lpl->zfs.size - lpl->zfs.min; + this->values[0] -= shrinkableSize; + this->values[3] += shrinkableSize; + this->values[4] += shrinkableSize; } } @@ -1035,7 +1040,7 @@ bool Platform_init(void) { char lineBuffer[256]; while (fgets(lineBuffer, sizeof(lineBuffer), fd)) { // detect lxc or overlayfs and guess that this means we are running containerized - if (String_startsWith(lineBuffer, "lxcfs ") || String_startsWith(lineBuffer, "overlay ")) { + if (String_startsWith(lineBuffer, "lxcfs /proc") || String_startsWith(lineBuffer, "overlay ")) { Running_containerized = true; break; } -- cgit v1.2.3