From b654082270084935afa24bb5220c9c4b82f9ef43 Mon Sep 17 00:00:00 2001 From: "W. Andrew Denton" Date: Tue, 14 Sep 2021 13:49:48 -0700 Subject: [PATCH 1/8] Expose device-mapper information as DeviceMapperInfo Signed-off-by: W. Andrew Denton --- blockdevice/stats.go | 49 +++++++++++++++++++++++++++++++- blockdevice/stats_test.go | 26 +++++++++++++++++ fixtures.ttar | 60 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+), 1 deletion(-) diff --git a/blockdevice/stats.go b/blockdevice/stats.go index 52139d3e8..f28f319fe 100644 --- a/blockdevice/stats.go +++ b/blockdevice/stats.go @@ -16,12 +16,13 @@ package blockdevice import ( "bufio" "fmt" - "github.com/prometheus/procfs/internal/util" "io" "io/ioutil" "os" "strings" + "github.com/prometheus/procfs/internal/util" + "github.com/prometheus/procfs/internal/fs" ) @@ -178,12 +179,30 @@ type BlockQueueStats struct { WriteZeroesMaxBytes uint64 } +// DeviceMapperInfo models the devicemapper files that are located in the sysfs tree for each block device +// and described in the kernel documentation: +// https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-block-dm +type DeviceMapperInfo struct { + // Name is the string containing mapped device name. + Name string + // RqBasedSeqIOMergeDeadline determines how long (in microseconds) a request that is a reasonable merge + // candidate can be queued on the request queue. + RqBasedSeqIOMergeDeadline uint64 + // Suspended indicates if the device is suspended (1 is on, 0 is off). + Suspended uint64 + // UseBlkMq indicates if the device is using the request-based blk-mq I/O path mode (1 is on, 0 is off). + UseBlkMq uint64 + // Uuid is the DM-UUID string or empty string if DM-UUID is not set. + Uuid string +} + const ( procDiskstatsPath = "diskstats" procDiskstatsFormat = "%d %d %s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" sysBlockPath = "block" sysBlockStatFormat = "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" sysBlockQueue = "queue" + sysBlockDm = "dm" ) // FS represents the pseudo-filesystems proc and sys, which provides an @@ -398,3 +417,31 @@ func (fs FS) SysBlockDeviceQueueStats(device string) (BlockQueueStats, error) { } return stat, nil } + +func (fs FS) SysBlockDeviceMapperInfo(device string) (DeviceMapperInfo, error) { + info := DeviceMapperInfo{} + // files with uint64 fields + for file, p := range map[string]*uint64{ + "rq_based_seq_io_merge_deadline": &info.RqBasedSeqIOMergeDeadline, + "suspended": &info.Suspended, + "use_blk_mq": &info.UseBlkMq, + } { + val, err := util.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysBlockDm, file)) + if err != nil { + return DeviceMapperInfo{}, err + } + *p = val + } + // files with string fields + for file, p := range map[string]*string{ + "name": &info.Name, + "uuid": &info.Uuid, + } { + val, err := util.SysReadFile(fs.sys.Path(sysBlockPath, device, sysBlockDm, file)) + if err != nil { + return DeviceMapperInfo{}, err + } + *p = val + } + return info, nil +} diff --git a/blockdevice/stats_test.go b/blockdevice/stats_test.go index c0a5768a4..cea2e5f5b 100644 --- a/blockdevice/stats_test.go +++ b/blockdevice/stats_test.go @@ -152,3 +152,29 @@ func TestBlockDevice(t *testing.T) { t.Errorf("Incorrect BlockQueueStat, expected: \n%+v, got: \n%+v", blockQueueStatExpected, blockQueueStat) } } + +func TestBlockDmInfo(t *testing.T) { + blockdevice, err := NewFS("../fixtures/proc", "../fixtures/sys") + if err != nil { + t.Fatalf("failed to access blockdevice fs: %v", err) + } + devices, err := blockdevice.SysBlockDevices() + if err != nil { + t.Fatal(err) + } + dm0Info, err := blockdevice.SysBlockDeviceMapperInfo(devices[0]) + if err != nil { + t.Fatal(err) + } + + dm0InfoExpected := DeviceMapperInfo{ + Name: "vg0--lv_root", + RqBasedSeqIOMergeDeadline: 0, + Suspended: 0, + UseBlkMq: 0, + Uuid: "LVM-3zSHSR5Nbf4j7g6auAAefWY2CMaX01theZYEvQyecVsm2WtX3iY5q51qq5dWWOq7", + } + if !reflect.DeepEqual(dm0Info, dm0InfoExpected) { + t.Errorf("Incorrect BlockQueueStat, expected: \n%+v, got: \n%+v", dm0InfoExpected, dm0Info) + } +} diff --git a/fixtures.ttar b/fixtures.ttar index e005ee94a..11b8f0bab 100644 --- a/fixtures.ttar +++ b/fixtures.ttar @@ -3231,6 +3231,34 @@ Mode: 775 Directory: fixtures/sys/block/dm-0 Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/block/dm-0/dm +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/block/dm-0/dm/name +Lines: 1 +vg0--lv_rootEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/block/dm-0/dm/rq_based_seq_io_merge_deadline +Lines: 1 +0EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/block/dm-0/dm/suspended +Lines: 1 +0EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/block/dm-0/dm/use_blk_mq +Lines: 1 +0EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/block/dm-0/dm/uuid +Lines: 1 +LVM-3zSHSR5Nbf4j7g6auAAefWY2CMaX01theZYEvQyecVsm2WtX3iY5q51qq5dWWOq7EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/dm-0/stat Lines: 1 6447303 0 710266738 1529043 953216 0 31201176 4557464 0 796160 6088971 @@ -3478,6 +3506,7 @@ Mode: 664 Directory: fixtures/sys/class Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +<<<<<<< HEAD Directory: fixtures/sys/class/dmi Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3593,6 +3622,28 @@ Path: fixtures/sys/class/dmi/id/uevent Lines: 1 MODALIAS=dmi:bvnDellInc.:bvr2.2.4:bd04/12/2021:br2.2:svnDellInc.:pnPowerEdgeR6515:pvr:rvnDellInc.:rn07PXPY:rvrA01:cvnDellInc.:ct23:cvr: Mode: 644 +======= +Directory: fixtures/sys/class/block +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-0 +SymlinkTo: ../../devices/virtual/block/dm-0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-1 +SymlinkTo: ../../devices/virtual/block/dm-1 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-2 +SymlinkTo: ../../devices/virtual/block/dm-2 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-3 +SymlinkTo: ../../devices/virtual/block/dm-3 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-4 +SymlinkTo: ../../devices/virtual/block/dm-4 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-5 +SymlinkTo: ../../devices/virtual/block/dm-5 +>>>>>>> fdb88ff (Expose device-mapper information as DeviceMapperInfo) # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/drm Mode: 755 @@ -6491,6 +6542,15 @@ nr_zone_active_file 11 nr_zone_unevictable 12 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/virtual +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/virtual/block +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/virtual/block/dm-0 +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/fs Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From ff3e3d2c831b0e61d7d2eb61683582bade0bd60e Mon Sep 17 00:00:00 2001 From: "W. Andrew Denton" Date: Tue, 14 Sep 2021 16:28:35 -0700 Subject: [PATCH 2/8] Enumerate block device slaves as UnderlyingDeviceInfo Signed-off-by: W. Andrew Denton --- blockdevice/stats.go | 23 ++++++++++++++++++++-- blockdevice/stats_test.go | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/blockdevice/stats.go b/blockdevice/stats.go index f28f319fe..7e22a52f8 100644 --- a/blockdevice/stats.go +++ b/blockdevice/stats.go @@ -21,9 +21,8 @@ import ( "os" "strings" - "github.com/prometheus/procfs/internal/util" - "github.com/prometheus/procfs/internal/fs" + "github.com/prometheus/procfs/internal/util" ) // Info contains identifying information for a block device such as a disk drive @@ -196,6 +195,12 @@ type DeviceMapperInfo struct { Uuid string } +// UnderlyingDevices models the list of devices that this device is built from. +type UnderlyingDeviceInfo struct { + // DeviceNames is the list of devices names + DeviceNames []string +} + const ( procDiskstatsPath = "diskstats" procDiskstatsFormat = "%d %d %s %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" @@ -203,6 +208,7 @@ const ( sysBlockStatFormat = "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" sysBlockQueue = "queue" sysBlockDm = "dm" + sysUnderlyingDev = "slaves" ) // FS represents the pseudo-filesystems proc and sys, which provides an @@ -445,3 +451,16 @@ func (fs FS) SysBlockDeviceMapperInfo(device string) (DeviceMapperInfo, error) { } return info, nil } + +func (fs FS) SysBlockDeviceUnderlyingDevices(device string) (UnderlyingDeviceInfo, error) { + underlyingDir, err := os.Open(fs.sys.Path(sysBlockPath, device, sysUnderlyingDev)) + if err != nil { + return UnderlyingDeviceInfo{}, err + } + underlying, err := underlyingDir.Readdirnames(0) + if err != nil { + return UnderlyingDeviceInfo{}, err + } + return UnderlyingDeviceInfo{DeviceNames: underlying}, nil + +} diff --git a/blockdevice/stats_test.go b/blockdevice/stats_test.go index cea2e5f5b..c37011aaf 100644 --- a/blockdevice/stats_test.go +++ b/blockdevice/stats_test.go @@ -14,6 +14,7 @@ package blockdevice import ( + "os" "reflect" "testing" ) @@ -177,4 +178,44 @@ func TestBlockDmInfo(t *testing.T) { if !reflect.DeepEqual(dm0Info, dm0InfoExpected) { t.Errorf("Incorrect BlockQueueStat, expected: \n%+v, got: \n%+v", dm0InfoExpected, dm0Info) } + + dm1Info, err := blockdevice.SysBlockDeviceMapperInfo(devices[1]) + if err != nil { + if _, ok := err.(*os.PathError); ok { + // Fail the test if there's an error other than PathError. + if !os.IsNotExist(err) { + t.Fatal(err) + } + } else { + t.Fatal(err) + } + } else { + t.Fatal("SysBlockDeviceMapperInfo on sda was supposed to fail.") + } + dm1InfoExpected := DeviceMapperInfo{} + if !reflect.DeepEqual(dm1Info, dm1InfoExpected) { + t.Errorf("Incorrect BlockQueueStat, expected: \n%+v, got: \n%+v", dm0InfoExpected, dm0Info) + } +} + +func TestSysBlockDeviceUnderlyingDevices(t *testing.T) { + blockdevice, err := NewFS("../fixtures/proc", "../fixtures/sys") + if err != nil { + t.Fatalf("failed to access blockdevice fs: %v", err) + } + devices, err := blockdevice.SysBlockDevices() + if err != nil { + t.Fatal(err) + } + + underlying0, err := blockdevice.SysBlockDeviceUnderlyingDevices(devices[0]) + if err != nil { + t.Fatal(err) + } + underlying0Expected := UnderlyingDeviceInfo{ + DeviceNames: []string{"sda"}, + } + if !reflect.DeepEqual(underlying0, underlying0Expected) { + t.Errorf("Incorrect BlockQueueStat, expected: \n%+v, got: \n%+v", underlying0Expected, underlying0) + } } From b1cd79e93344feca48bfffddd47e00008c6c14a8 Mon Sep 17 00:00:00 2001 From: "W. Andrew Denton" Date: Tue, 14 Sep 2021 16:38:14 -0700 Subject: [PATCH 3/8] Add missing fixtures. Signed-off-by: W. Andrew Denton --- fixtures.ttar | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fixtures.ttar b/fixtures.ttar index 11b8f0bab..018b18be2 100644 --- a/fixtures.ttar +++ b/fixtures.ttar @@ -3259,6 +3259,13 @@ Lines: 1 LVM-3zSHSR5Nbf4j7g6auAAefWY2CMaX01theZYEvQyecVsm2WtX3iY5q51qq5dWWOq7EOF Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/block/dm-0/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/block/dm-0/slaves/sda +Lines: 0 +Mode: 664 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/dm-0/stat Lines: 1 6447303 0 710266738 1529043 953216 0 31201176 4557464 0 796160 6088971 From 2129811cb72da0745351186d635649163abbd12f Mon Sep 17 00:00:00 2001 From: "W. Andrew Denton" Date: Fri, 19 Nov 2021 11:07:08 -0800 Subject: [PATCH 4/8] blockdevice/stats: uppercase initialisms. Signed-off-by: W. Andrew Denton --- blockdevice/stats.go | 18 +++++++++--------- blockdevice/stats_test.go | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/blockdevice/stats.go b/blockdevice/stats.go index 7e22a52f8..26b6f57cb 100644 --- a/blockdevice/stats.go +++ b/blockdevice/stats.go @@ -189,10 +189,10 @@ type DeviceMapperInfo struct { RqBasedSeqIOMergeDeadline uint64 // Suspended indicates if the device is suspended (1 is on, 0 is off). Suspended uint64 - // UseBlkMq indicates if the device is using the request-based blk-mq I/O path mode (1 is on, 0 is off). - UseBlkMq uint64 - // Uuid is the DM-UUID string or empty string if DM-UUID is not set. - Uuid string + // UseBlkMQ indicates if the device is using the request-based blk-mq I/O path mode (1 is on, 0 is off). + UseBlkMQ uint64 + // UUID is the DM-UUID string or empty string if DM-UUID is not set. + UUID string } // UnderlyingDevices models the list of devices that this device is built from. @@ -207,7 +207,7 @@ const ( sysBlockPath = "block" sysBlockStatFormat = "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" sysBlockQueue = "queue" - sysBlockDm = "dm" + sysBlockDM = "dm" sysUnderlyingDev = "slaves" ) @@ -430,9 +430,9 @@ func (fs FS) SysBlockDeviceMapperInfo(device string) (DeviceMapperInfo, error) { for file, p := range map[string]*uint64{ "rq_based_seq_io_merge_deadline": &info.RqBasedSeqIOMergeDeadline, "suspended": &info.Suspended, - "use_blk_mq": &info.UseBlkMq, + "use_blk_mq": &info.UseBlkMQ, } { - val, err := util.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysBlockDm, file)) + val, err := util.ReadUintFromFile(fs.sys.Path(sysBlockPath, device, sysBlockDM, file)) if err != nil { return DeviceMapperInfo{}, err } @@ -441,9 +441,9 @@ func (fs FS) SysBlockDeviceMapperInfo(device string) (DeviceMapperInfo, error) { // files with string fields for file, p := range map[string]*string{ "name": &info.Name, - "uuid": &info.Uuid, + "uuid": &info.UUID, } { - val, err := util.SysReadFile(fs.sys.Path(sysBlockPath, device, sysBlockDm, file)) + val, err := util.SysReadFile(fs.sys.Path(sysBlockPath, device, sysBlockDM, file)) if err != nil { return DeviceMapperInfo{}, err } diff --git a/blockdevice/stats_test.go b/blockdevice/stats_test.go index c37011aaf..a701bcd2a 100644 --- a/blockdevice/stats_test.go +++ b/blockdevice/stats_test.go @@ -172,8 +172,8 @@ func TestBlockDmInfo(t *testing.T) { Name: "vg0--lv_root", RqBasedSeqIOMergeDeadline: 0, Suspended: 0, - UseBlkMq: 0, - Uuid: "LVM-3zSHSR5Nbf4j7g6auAAefWY2CMaX01theZYEvQyecVsm2WtX3iY5q51qq5dWWOq7", + UseBlkMQ: 0, + UUID: "LVM-3zSHSR5Nbf4j7g6auAAefWY2CMaX01theZYEvQyecVsm2WtX3iY5q51qq5dWWOq7", } if !reflect.DeepEqual(dm0Info, dm0InfoExpected) { t.Errorf("Incorrect BlockQueueStat, expected: \n%+v, got: \n%+v", dm0InfoExpected, dm0Info) From dcd871f850746e81c6ae8ac3bf03a5614cebd56e Mon Sep 17 00:00:00 2001 From: "W. Andrew Denton" Date: Fri, 19 Nov 2021 11:21:48 -0800 Subject: [PATCH 5/8] Expose device-mapper information as DeviceMapperInfo Signed-off-by: W. Andrew Denton --- fixtures.ttar | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fixtures.ttar b/fixtures.ttar index 018b18be2..a84b7c6a7 100644 --- a/fixtures.ttar +++ b/fixtures.ttar @@ -3259,13 +3259,6 @@ Lines: 1 LVM-3zSHSR5Nbf4j7g6auAAefWY2CMaX01theZYEvQyecVsm2WtX3iY5q51qq5dWWOq7EOF Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: fixtures/sys/block/dm-0/slaves -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/sys/block/dm-0/slaves/sda -Lines: 0 -Mode: 664 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/dm-0/stat Lines: 1 6447303 0 710266738 1529043 953216 0 31201176 4557464 0 796160 6088971 @@ -3513,7 +3506,6 @@ Mode: 664 Directory: fixtures/sys/class Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<<<<<<< HEAD Directory: fixtures/sys/class/dmi Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3629,7 +3621,6 @@ Path: fixtures/sys/class/dmi/id/uevent Lines: 1 MODALIAS=dmi:bvnDellInc.:bvr2.2.4:bd04/12/2021:br2.2:svnDellInc.:pnPowerEdgeR6515:pvr:rvnDellInc.:rn07PXPY:rvrA01:cvnDellInc.:ct23:cvr: Mode: 644 -======= Directory: fixtures/sys/class/block Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3650,7 +3641,6 @@ SymlinkTo: ../../devices/virtual/block/dm-4 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/class/block/dm-5 SymlinkTo: ../../devices/virtual/block/dm-5 ->>>>>>> fdb88ff (Expose device-mapper information as DeviceMapperInfo) # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/drm Mode: 755 From f50901f06c07933cd79806dceb348356b41124e7 Mon Sep 17 00:00:00 2001 From: "W. Andrew Denton" Date: Fri, 19 Nov 2021 11:25:53 -0800 Subject: [PATCH 6/8] Expose device-mapper information as DeviceMapperInfo Signed-off-by: W. Andrew Denton --- fixtures.ttar | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fixtures.ttar b/fixtures.ttar index a84b7c6a7..803a36e2c 100644 --- a/fixtures.ttar +++ b/fixtures.ttar @@ -3259,6 +3259,13 @@ Lines: 1 LVM-3zSHSR5Nbf4j7g6auAAefWY2CMaX01theZYEvQyecVsm2WtX3iY5q51qq5dWWOq7EOF Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/block/dm-0/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/block/dm-0/slaves/sda +Lines: 0 +Mode: 664 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/sys/block/dm-0/stat Lines: 1 6447303 0 710266738 1529043 953216 0 31201176 4557464 0 796160 6088971 From 3a44d22c97509a835909740f100b7837ee5d38e1 Mon Sep 17 00:00:00 2001 From: "W. Andrew Denton" Date: Fri, 19 Nov 2021 11:29:46 -0800 Subject: [PATCH 7/8] Update fixtures. Signed-off-by: W. Andrew Denton --- fixtures.ttar | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/fixtures.ttar b/fixtures.ttar index 803a36e2c..a920770c7 100644 --- a/fixtures.ttar +++ b/fixtures.ttar @@ -3513,6 +3513,27 @@ Mode: 664 Directory: fixtures/sys/class Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/block +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-0 +SymlinkTo: ../../devices/virtual/block/dm-0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-1 +SymlinkTo: ../../devices/virtual/block/dm-1 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-2 +SymlinkTo: ../../devices/virtual/block/dm-2 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-3 +SymlinkTo: ../../devices/virtual/block/dm-3 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-4 +SymlinkTo: ../../devices/virtual/block/dm-4 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/block/dm-5 +SymlinkTo: ../../devices/virtual/block/dm-5 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/dmi Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3628,26 +3649,6 @@ Path: fixtures/sys/class/dmi/id/uevent Lines: 1 MODALIAS=dmi:bvnDellInc.:bvr2.2.4:bd04/12/2021:br2.2:svnDellInc.:pnPowerEdgeR6515:pvr:rvnDellInc.:rn07PXPY:rvrA01:cvnDellInc.:ct23:cvr: Mode: 644 -Directory: fixtures/sys/class/block -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/sys/class/block/dm-0 -SymlinkTo: ../../devices/virtual/block/dm-0 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/sys/class/block/dm-1 -SymlinkTo: ../../devices/virtual/block/dm-1 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/sys/class/block/dm-2 -SymlinkTo: ../../devices/virtual/block/dm-2 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/sys/class/block/dm-3 -SymlinkTo: ../../devices/virtual/block/dm-3 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/sys/class/block/dm-4 -SymlinkTo: ../../devices/virtual/block/dm-4 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: fixtures/sys/class/block/dm-5 -SymlinkTo: ../../devices/virtual/block/dm-5 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/drm Mode: 755 From 29cb23ccdb5f90560d8adcdec7192d61bfd1aabc Mon Sep 17 00:00:00 2001 From: "W. Andrew Denton" Date: Fri, 3 Dec 2021 16:11:49 -0800 Subject: [PATCH 8/8] Capitalize comments. Signed-off-by: W. Andrew Denton --- blockdevice/stats.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/blockdevice/stats.go b/blockdevice/stats.go index 26b6f57cb..56e9a475f 100644 --- a/blockdevice/stats.go +++ b/blockdevice/stats.go @@ -342,7 +342,7 @@ func (fs FS) SysBlockDeviceStat(device string) (IOStats, int, error) { // SysBlockDeviceQueueStats returns stats for /sys/block/xxx/queue where xxx is a device name. func (fs FS) SysBlockDeviceQueueStats(device string) (BlockQueueStats, error) { stat := BlockQueueStats{} - // files with uint64 fields + // Files with uint64 fields for file, p := range map[string]*uint64{ "add_random": &stat.AddRandom, "dax": &stat.DAX, @@ -380,7 +380,7 @@ func (fs FS) SysBlockDeviceQueueStats(device string) (BlockQueueStats, error) { } *p = val } - // files with int64 fields + // Files with int64 fields for file, p := range map[string]*int64{ "io_poll_delay": &stat.IOPollDelay, "wbt_lat_usec": &stat.WBTLatUSec, @@ -391,7 +391,7 @@ func (fs FS) SysBlockDeviceQueueStats(device string) (BlockQueueStats, error) { } *p = val } - // files with string fields + // Files with string fields for file, p := range map[string]*string{ "write_cache": &stat.WriteCache, "zoned": &stat.Zoned, @@ -426,7 +426,7 @@ func (fs FS) SysBlockDeviceQueueStats(device string) (BlockQueueStats, error) { func (fs FS) SysBlockDeviceMapperInfo(device string) (DeviceMapperInfo, error) { info := DeviceMapperInfo{} - // files with uint64 fields + // Files with uint64 fields for file, p := range map[string]*uint64{ "rq_based_seq_io_merge_deadline": &info.RqBasedSeqIOMergeDeadline, "suspended": &info.Suspended, @@ -438,7 +438,7 @@ func (fs FS) SysBlockDeviceMapperInfo(device string) (DeviceMapperInfo, error) { } *p = val } - // files with string fields + // Files with string fields for file, p := range map[string]*string{ "name": &info.Name, "uuid": &info.UUID,