Skip to content

Commit e050d54

Browse files
committed
Fix build errors
1 parent 9c13e5d commit e050d54

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

blockdevice/stats.go

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,6 @@ func parseProcDiskstats(r io.Reader) ([]Diskstats, error) {
303303
return diskstats, scanner.Err()
304304
}
305305

306-
func parseProcDiskstats(r io.Reader) ([]Diskstats, error) {
307-
// Read device ioerr_cnt and iodone_cnt
308-
val, err := util.ReadHexFromFile(fs.sys.Path(sysBlockPath, device, sysIoDoneCntPath))
309-
diskstats = append(diskstats, val)
310-
val, err := util.ReadHexFromFile(fs.sys.Path(sysBlockPath, device, sysIoDoneCntPath))
311-
diskstats = append(diskstats, val)
312-
}
313-
314306
// SysBlockDevices lists the device names from /sys/block/<dev>.
315307
func (fs FS) SysBlockDevices() ([]string, error) {
316308
deviceDirs, err := os.ReadDir(fs.sys.Path(sysBlockPath))
@@ -492,19 +484,21 @@ func (fs FS) SysBlockDeviceUnderlyingDevices(device string) (UnderlyingDeviceInf
492484
// SysBlockDeviceIO returns stats for the block device read io counters
493485
// IO done count: /sys/block/<disk>/device/iodone_cnt
494486
// IO error count: /sys/block/<disk>/device/ioerr_cnt
495-
func (fs FS) SysBlockDeviceIOStat(device string) (IOStats, int, error) {
487+
func (fs FS) SysBlockDeviceIOStat(device string) (IODeviceStats, error) {
496488
var (
497-
ioDeviceStats []IODeviceStats
489+
ioDeviceStats IODeviceStats
490+
err error
498491
)
499492
for file, p := range map[string]*uint64{
500-
"iodone_cnt": &ioDeviceStats.ioDoneCount,
501-
"ioerr_cnt": &ioDeviceStats.ioErrCount,
493+
"iodone_cnt": &ioDeviceStats.IODoneCount,
494+
"ioerr_cnt": &ioDeviceStats.IOErrCount,
502495
} {
503-
val, err := util.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysDevicePath, file))
504-
if err != nil {
505-
return IODeviceStats{}, err
506-
}
507-
*p = val
496+
var val uint64
497+
val, err = util.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysDevicePath, file))
498+
if err != nil {
499+
return IODeviceStats{}, err
500+
}
501+
*p = val
508502
}
509-
return ioDeviceStats, err
510-
}
503+
return ioDeviceStats, nil
504+
}

0 commit comments

Comments
 (0)