From b8100f472b33a1cbd82f67947f0d0f36aa6836ed Mon Sep 17 00:00:00 2001 From: mwiegand Date: Thu, 23 Jun 2022 02:13:06 +0200 Subject: [PATCH] zfs zfs_arc_max --- bundles/zfs/metadata.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bundles/zfs/metadata.py b/bundles/zfs/metadata.py index eeb4afb..1364063 100644 --- a/bundles/zfs/metadata.py +++ b/bundles/zfs/metadata.py @@ -136,3 +136,23 @@ def headers(metadata): }, }, } + + +@metadata_reactor.provides( + 'zfs/kernel_params/zfs_arc_max', +) +def arc_size(metadata): + arc_percent = metadata.get('zfs/zfs_arc_max_percent', None) + + if arc_percent: + return { + 'zfs': { + 'kernel_params': { + 'zfs_arc_max': str(int( + metadata.get('vm/ram') * 1024 * 1024 * (arc_percent/100) + )), + }, + }, + } + else: + return {}