• David Sterba's avatar
    btrfs: sysfs: export dev stats in devinfo directory · da658b57
    David Sterba authored
    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: default avatarAnand Jain <anand.jain@oracle.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    da658b57
sysfs.c 53.6 KB