]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: sysfs: export dev stats in devinfo directory
authorDavid Sterba <dsterba@suse.com>
Fri, 4 Jun 2021 13:00:05 +0000 (15:00 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 22 Jun 2021 12:11:57 +0000 (14:11 +0200)
commitb7f57ebdeb00baa49b860b808bbf2f37d99a2451
tree0bff8278782f91f78b45ee016053a3dca2050d18
parent4a3401fe23d8b70d0dbcb492670c4431d8d7d0a7
btrfs: sysfs: export dev stats in devinfo directory

The device stats can be read by ioctl, wrapped by command 'btrfs device
stats'. Provide another source where to read the information in
/sys/fs/btrfs/FSID/devinfo/DEVID/error_stats . The format is a list of
'key value' pairs one per line, which is common in other stat files.
The names are the same as used in other device stat outputs.

The stats are all in one file as it's the snapshot of all available
stats. The 'one value per file' format is not very suitable here. The
stats should be valid right after the stats item is read from disk,
shortly after initializing the device.

In case the stats are not yet valid, print just 'invalid' as the file
contents.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/sysfs.c