From 77896dbfaa2d1b382fe223402c5e769b28f98868 Mon Sep 17 00:00:00 2001 From: chrislu Date: Tue, 4 Nov 2025 21:46:17 -0800 Subject: [PATCH] simplify --- weed/topology/disk.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/weed/topology/disk.go b/weed/topology/disk.go index 1aa0c43e0..f27589916 100644 --- a/weed/topology/disk.go +++ b/weed/topology/disk.go @@ -180,12 +180,12 @@ func (d *Disk) doAddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChanged bool) // Adjust active volume count when ReadOnly status changes // Use a separate delta object to avoid affecting other metric adjustments readOnlyDelta := &DiskUsageCounts{} - if !v.ReadOnly && oldV.ReadOnly { - // Changed from read-only to writable - readOnlyDelta.activeVolumeCount = 1 - } else if v.ReadOnly && !oldV.ReadOnly { + if v.ReadOnly { // Changed from writable to read-only readOnlyDelta.activeVolumeCount = -1 + } else { + // Changed from read-only to writable + readOnlyDelta.activeVolumeCount = 1 } d.UpAdjustDiskUsageDelta(types.ToDiskType(v.DiskType), readOnlyDelta) }