From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 500B07EF49 for ; Thu, 11 Nov 2021 18:17:37 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 44817FACA for ; Thu, 11 Nov 2021 18:17:37 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 915B7FAC1 for ; Thu, 11 Nov 2021 18:17:36 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 6458344BE9 for ; Thu, 11 Nov 2021 18:17:36 +0100 (CET) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Thu, 11 Nov 2021 18:17:25 +0100 Message-Id: <20211111171725.127010-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.324 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH zfsonlinux] arcstat/arc_summary: workaround for stats only present with cache device X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Nov 2021 17:17:37 -0000 This commit updates Thomas' patch to deal with a 2.0 kernel module with 2.1 arc_summary/arcstat Tested by adding a cache-device to a zpool and running both commands to verify no KeyError exception is thrown. Signed-off-by: Stoiko Ivanov --- I hope the fixup in the patch and commit-log above my S-o-b tag is ok - else feel free to adapt (can also gladly resend) ...-guard-access-to-l2arc-MFU-MRU-stats.patch | 63 +++++++++++++++++-- 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/debian/patches/0011-arc-stat-summary-guard-access-to-l2arc-MFU-MRU-stats.patch b/debian/patches/0011-arc-stat-summary-guard-access-to-l2arc-MFU-MRU-stats.patch index ead0943c..6a704848 100644 --- a/debian/patches/0011-arc-stat-summary-guard-access-to-l2arc-MFU-MRU-stats.patch +++ b/debian/patches/0011-arc-stat-summary-guard-access-to-l2arc-MFU-MRU-stats.patch @@ -15,13 +15,18 @@ should be better to show some possible wrong data for new stat-keys than throwing an exception. Signed-off-by: Thomas Lamprecht + +also move l2_mfu_asize l2_mru_asize l2_prefetch_asize +l2_bufc_data_asize l2_bufc_metadata_asize to .get accessor +(these are only present with a cache device in the pool) +Signed-off-by: Stoiko Ivanov --- - cmd/arc_summary/arc_summary3 | 8 ++++---- - cmd/arcstat/arcstat.in | 4 ++-- - 2 files changed, 6 insertions(+), 6 deletions(-) + cmd/arc_summary/arc_summary3 | 28 ++++++++++++++-------------- + cmd/arcstat/arcstat.in | 14 +++++++------- + 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cmd/arc_summary/arc_summary3 b/cmd/arc_summary/arc_summary3 -index 7b28012ed..0a81b2bc7 100755 +index 7b28012ed..fe6a6d9e2 100755 --- a/cmd/arc_summary/arc_summary3 +++ b/cmd/arc_summary/arc_summary3 @@ -617,13 +617,13 @@ def section_arc(kstats_dict): @@ -42,8 +47,39 @@ index 7b28012ed..0a81b2bc7 100755 prt_i1('L2 ineligible evictions:', f_bytes(arc_stats['evict_l2_ineligible'])) print() +@@ -765,20 +765,20 @@ def section_l2arc(kstats_dict): + f_perc(arc_stats['l2_hdr_size'], arc_stats['l2_size']), + f_bytes(arc_stats['l2_hdr_size'])) + prt_i2('MFU allocated size:', +- f_perc(arc_stats['l2_mfu_asize'], arc_stats['l2_asize']), +- f_bytes(arc_stats['l2_mfu_asize'])) ++ f_perc(arc_stats.get('l2_mfu_asize', 0), arc_stats['l2_asize']), ++ f_bytes(arc_stats.get('l2_mfu_asize', 0))) # 2.0 module compat + prt_i2('MRU allocated size:', +- f_perc(arc_stats['l2_mru_asize'], arc_stats['l2_asize']), +- f_bytes(arc_stats['l2_mru_asize'])) ++ f_perc(arc_stats.get('l2_mru_asize', 0), arc_stats['l2_asize']), ++ f_bytes(arc_stats.get('l2_mru_asize', 0))) # 2.0 module compat + prt_i2('Prefetch allocated size:', +- f_perc(arc_stats['l2_prefetch_asize'], arc_stats['l2_asize']), +- f_bytes(arc_stats['l2_prefetch_asize'])) ++ f_perc(arc_stats.get('l2_prefetch_asize', 0), arc_stats['l2_asize']), ++ f_bytes(arc_stats.get('l2_prefetch_asize',0))) # 2.0 module compat + prt_i2('Data (buffer content) allocated size:', +- f_perc(arc_stats['l2_bufc_data_asize'], arc_stats['l2_asize']), +- f_bytes(arc_stats['l2_bufc_data_asize'])) ++ f_perc(arc_stats.get('l2_bufc_data_asize', 0), arc_stats['l2_asize']), ++ f_bytes(arc_stats.get('l2_bufc_data_asize', 0))) # 2.0 module compat + prt_i2('Metadata (buffer content) allocated size:', +- f_perc(arc_stats['l2_bufc_metadata_asize'], arc_stats['l2_asize']), +- f_bytes(arc_stats['l2_bufc_metadata_asize'])) ++ f_perc(arc_stats.get('l2_bufc_metadata_asize', 0), arc_stats['l2_asize']), ++ f_bytes(arc_stats.get('l2_bufc_metadata_asize', 0))) # 2.0 module compat + + print() + prt_1('L2ARC breakdown:', f_hits(l2_access_total)) diff --git a/cmd/arcstat/arcstat.in b/cmd/arcstat/arcstat.in -index cd9a803a2..6878419e7 100755 +index cd9a803a2..ea45dc602 100755 --- a/cmd/arcstat/arcstat.in +++ b/cmd/arcstat/arcstat.in @@ -482,8 +482,8 @@ def calculate(): @@ -57,3 +93,20 @@ index cd9a803a2..6878419e7 100755 v["el2inel"] = d["evict_l2_ineligible"] // sint v["mtxmis"] = d["mutex_miss"] // sint +@@ -498,11 +498,11 @@ def calculate(): + v["l2size"] = cur["l2_size"] + v["l2bytes"] = d["l2_read_bytes"] // sint + +- v["l2pref"] = cur["l2_prefetch_asize"] +- v["l2mfu"] = cur["l2_mfu_asize"] +- v["l2mru"] = cur["l2_mru_asize"] +- v["l2data"] = cur["l2_bufc_data_asize"] +- v["l2meta"] = cur["l2_bufc_metadata_asize"] ++ v["l2pref"] = cur.get("l2_prefetch_asize", 0) ++ v["l2mfu"] = cur.get("l2_mfu_asize", 0) ++ v["l2mru"] = cur.get("l2_mru_asize", 0) ++ v["l2data"] = cur.get("l2_bufc_data_asize", 0) ++ v["l2meta"] = cur.get("l2_bufc_metadata_asize", 0) + v["l2pref%"] = 100 * v["l2pref"] // v["l2asize"] + v["l2mfu%"] = 100 * v["l2mfu"] // v["l2asize"] + v["l2mru%"] = 100 * v["l2mru"] // v["l2asize"] -- 2.30.2