Skip to contentSkip to conversation

btrfs-progs: device stats: Print devid instead of null

PATCH Applied Patrik Lundquist 2 participants 2 messages Apr 5, 2016 – Apr 7, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 cmds-device.c | 7 +++++++
 1 file changed, 7 insertions(+)
cmds-device.c +7 -0
index b17b6c6..7616c43 100644
@@ -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,
Signature · 1 line
2.8.0.rc3