]> 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)
commit383f4963be9ff259126968a12885b32ceb905de3
tree0bff8278782f91f78b45ee016053a3dca2050d18
parentfb145caa72401902569c9f1edb762ed5f3a5a95e
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