NeilBrown: Fix the used device size in mdadm -D output.

Martin F. Krafft madduck at
Mon Feb 16 10:52:45 UTC 2009

Module: mdadm
Branch: master
Commit: a1236192111a8425e6c6d81c44103e9f4a2f465c

Author: NeilBrown <neilb at>
Date:   Mon Feb  2 10:03:20 2009 +1100

Fix the used device size in mdadm -D output.

As get_component_size() returns the number of used sectors of a device
we need halve before pringing as K, and shift the value by 9, not 10,
before passing to human_size.

Thanks to Andre Noll <maan at> for identifying problem
(and a slightly different version of this patch)

Signed-off-by: NeilBrown <neilb at>


 Detail.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Detail.c b/Detail.c
index 3cee66f..8f86ead 100644
--- a/Detail.c
+++ b/Detail.c
@@ -198,8 +198,8 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
 				unsigned long long dsize = get_component_size(fd);
 				if (dsize > 0)
 					printf("  Used Dev Size : %llu%s\n",
-					       dsize,
-					 human_size((long long)dsize<<10));
+					       dsize/2,
+					 human_size((long long)dsize<<9));
 					printf("  Used Dev Size : unknown\n");
 			} else

More information about the pkg-mdadm-commits mailing list