* [PATCH] btrfs-progs: device usage: don't calculate slack on missing device
@ 2017-08-31 11:00 Patrik Lundquist
2017-09-04 16:35 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Patrik Lundquist @ 2017-08-31 11:00 UTC (permalink / raw)
To: linux-btrfs; +Cc: Patrik Lundquist
Print Device slack: 0.00B
instead of Device slack: 16.00EiB
Signed-off-by: Patrik Lundquist <patrik.lundquist@gmail.com>
---
cmds-fi-usage.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c
index 101a0c4..6c846c1 100644
--- a/cmds-fi-usage.c
+++ b/cmds-fi-usage.c
@@ -1040,6 +1040,7 @@ void print_device_sizes(struct device_info *devinfo, unsigned unit_mode)
pretty_size_mode(devinfo->device_size, unit_mode));
printf(" Device slack: %*s%10s\n",
(int)(20 - strlen("Device slack")), "",
- pretty_size_mode(devinfo->device_size - devinfo->size,
+ pretty_size_mode(devinfo->device_size > 0 ?
+ devinfo->device_size - devinfo->size : 0,
unit_mode));
}
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-04 16:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-31 11:00 [PATCH] btrfs-progs: device usage: don't calculate slack on missing device Patrik Lundquist
2017-09-04 16:35 ` 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).