public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH] fix #7551: smartctl: negative values are reported for SSD wear level
@ 2026-10-23 20:51 piknew
  0 siblings, 0 replies; only message in thread
From: piknew @ 2026-10-23 20:51 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: piknew <mparka@wp.pl>
---
 src/PVE/Diskmanage.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index d9ce0d0..2d01803 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -451,6 +451,13 @@ sub get_wear_leveling_info {
         foreach my $attr (@$attributes) {
             next if $attr->{name} !~ m/$register/;
             $wearout = $attr->{value};
+            # As of https://bugzilla.proxmox.com/show_bug.cgi?id=7551
+            # Some SSDs (Crucial MX500 for example) are reporting wearout over 100%
+            # This is directly reflected in "raw".
+            # When using "value" (wrapped a 8-bit unsigned integer), it shall be normalized.
+            # Example:
+            # 101% -> value=255, 102% -> value=254, 103% -> value=253
+            $wearout = $wearout - 256 if($wearout > 100);
             last;
         }
     }
-- 
2.43.0.windows.1





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-27  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23 20:51 [PATCH] fix #7551: smartctl: negative values are reported for SSD wear level piknew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal