diff options
author | Patrik Lundquist <patrik.lundquist@gmail.com> | 2016-04-05 17:27:43 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-05-02 14:41:54 +0200 |
commit | a963abc3d32cc3ca8ebf202f1227064fdd9c14a6 (patch) | |
tree | 14dce5724384f89ebaf78b39edac95eeba0563f3 /cmds-device.c | |
parent | 972cfbe32fecc4844284277e33429371146a08aa (diff) |
btrfs-progs: device stats: Print devid instead of null
Print e.g. "[devid:4].write_io_errs 6" instead of
"[(null)].write_io_errs 6" when device is missing.
Signed-off-by: Patrik Lundquist <patrik.lundquist@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-device.c')
-rw-r--r-- | cmds-device.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cmds-device.c b/cmds-device.c index b17b6c6f..7616c430 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -447,6 +447,13 @@ static int cmd_device_stats(int argc, char **argv) canonical_path = canonicalize_path((char *)path); + /* No path when device is missing. */ + if (!canonical_path) { + canonical_path = malloc(32); + snprintf(canonical_path, 32, + "devid:%llu", args.devid); + } + if (args.nr_items >= BTRFS_DEV_STAT_WRITE_ERRS + 1) printf("[%s].write_io_errs %llu\n", canonical_path, |