]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix the used device size in mdadm -D output.
authorNeilBrown <neilb@suse.de>
Sun, 1 Feb 2009 23:03:20 +0000 (10:03 +1100)
committerNeilBrown <neilb@suse.de>
Sun, 1 Feb 2009 23:03:20 +0000 (10:03 +1100)
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@systemlinux.org> for identifying problem
(and a slightly different version of this patch)

Signed-off-by: NeilBrown <neilb@suse.de>
Detail.c

index 3cee66fed89c8c6a315fa60efd3ce3ae7d196bd4..8f86ead88c1ef995d791ddd008907741ea2cc2fe 100644 (file)
--- 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));
                                else
                                        printf("  Used Dev Size : unknown\n");
                        } else