From 509d81dc663784038f676a78f0d69cca5b8dbb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sat, 20 Aug 2022 11:59:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A3=80=E6=B5=8B=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E4=B8=BA=E9=AB=98=E9=80=9F=E7=A1=AC=E7=9B=98=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E6=A3=80=E6=9F=A5sda/vda=E8=AE=BE=E5=A4=87=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/node.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/nodes/node.go b/internal/nodes/node.go index d5bb423..9afa50e 100644 --- a/internal/nodes/node.go +++ b/internal/nodes/node.go @@ -1010,10 +1010,13 @@ func (this *Node) reloadServer() { } func (this *Node) checkDisk() { - if runtime.GOOS == "linux" { + if runtime.GOOS != "linux" { + return + } + for n := 'a'; n <= 'z'; n++ { for _, path := range []string{ - "/sys/block/vda/queue/rotational", - "/sys/block/sda/queue/rotational", + "/sys/block/vd" + string(n) + "/queue/rotational", + "/sys/block/sd" + string(n) + "/queue/rotational", } { data, err := os.ReadFile(path) if err != nil { @@ -1022,7 +1025,7 @@ func (this *Node) checkDisk() { if string(data) == "0" { teaconst.DiskIsFast = true } - break + return } } }