* [PATCH] btrfs-progs: device stats: Print devid instead of null
@ 2016-04-05 15:27 Patrik Lundquist
2016-04-07 11:59 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Patrik Lundquist @ 2016-04-05 15:27 UTC (permalink / raw)
To: linux-btrfs; +Cc: Patrik Lundquist
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>
---
cmds-device.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/cmds-device.c b/cmds-device.c
index b17b6c6..7616c43 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,
--
2.8.0.rc3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs-progs: device stats: Print devid instead of null
2016-04-05 15:27 [PATCH] btrfs-progs: device stats: Print devid instead of null Patrik Lundquist
@ 2016-04-07 11:59 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2016-04-07 11:59 UTC (permalink / raw)
To: Patrik Lundquist; +Cc: linux-btrfs
On Tue, Apr 05, 2016 at 05:27:43PM +0200, Patrik Lundquist wrote:
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-07 12:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 15:27 [PATCH] btrfs-progs: device stats: Print devid instead of null Patrik Lundquist
2016-04-07 11:59 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).