diff options
author | Gui Hecheng <guihc.fnst@cn.fujitsu.com> | 2014-11-13 09:36:20 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-11-14 11:02:33 +0100 |
commit | a1c3bcf1c294909801dbc23e77cac895dd14c41e (patch) | |
tree | d0766c1a8d3311f6b89943e2d3cad42f06a50a05 /cmds-device.c | |
parent | 0c44c195fecad7db4bba064e6785faadf5c686b8 (diff) |
btrfs-progs: use canonical name for device in btrfs fi show when mounted
When using lvm volumes to check fstests: btrfs/006, it fails like:
Label: 'TestLabel.006' uuid: <UUID>
Total devices <EXACTNUM> FS bytes used <SIZE>
devid <DEVID> size <SIZE> used <SIZE> path SCRATCH_DEV
+ devid <DEVID> size <SIZE> used <SIZE> path /dev/dm-4
+ devid <DEVID> size <SIZE> used <SIZE> path /dev/dm-5
+ devid <DEVID> size <SIZE> used <SIZE> path /dev/dm-6
The /dev/dm-* points to lvm volumes, use @canonicalize_path() to convert them
and we will make it through. Of course we should do the same thing for dev stat.
Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-device.c')
-rw-r--r-- | cmds-device.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cmds-device.c b/cmds-device.c index 93239861..6cd41e1c 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -408,31 +408,37 @@ static int cmd_dev_stats(int argc, char **argv) path, strerror(errno)); err = 1; } else { + char *canonical_path; + + canonical_path = canonicalize_path((char *)path); + if (args.nr_items >= BTRFS_DEV_STAT_WRITE_ERRS + 1) printf("[%s].write_io_errs %llu\n", - path, + canonical_path, (unsigned long long) args.values[ BTRFS_DEV_STAT_WRITE_ERRS]); if (args.nr_items >= BTRFS_DEV_STAT_READ_ERRS + 1) printf("[%s].read_io_errs %llu\n", - path, + canonical_path, (unsigned long long) args.values[ BTRFS_DEV_STAT_READ_ERRS]); if (args.nr_items >= BTRFS_DEV_STAT_FLUSH_ERRS + 1) printf("[%s].flush_io_errs %llu\n", - path, + canonical_path, (unsigned long long) args.values[ BTRFS_DEV_STAT_FLUSH_ERRS]); if (args.nr_items >= BTRFS_DEV_STAT_CORRUPTION_ERRS + 1) printf("[%s].corruption_errs %llu\n", - path, + canonical_path, (unsigned long long) args.values[ BTRFS_DEV_STAT_CORRUPTION_ERRS]); if (args.nr_items >= BTRFS_DEV_STAT_GENERATION_ERRS + 1) printf("[%s].generation_errs %llu\n", - path, + canonical_path, (unsigned long long) args.values[ BTRFS_DEV_STAT_GENERATION_ERRS]); + + free(canonical_path); } } |