Re: [PATCH 0/2] md: More block -> sector conversions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18:26, Peter Rabbitson wrote:
> > Can you reproduce the incorrect output for the used device size
> > with the recent master branch of the mdadm git tree?
> > 
> 
> Hi Andre,
> 
> Yes I can:

[snip]

>   Used Dev Size : 576720896 (550.00 GiB 590.56 GB)

This is twice as much as it should be due to a bug in mdadm which bites
only for version1 superblocks. The patch below should fix it. However,
this might not be the most elegant solution because the real bug
is IMHO that get_component_size() multiplies the value from sysfs
(which is always in 1K units) by two, so it returns 2K units which
looks a bit weird.

Since there are more callers of get_component_size() I have to take
a deeper look to come up with a more reasonable patch.

Have fun
Andre

diff --git a/Detail.c b/Detail.c
index 3cee66f..cef1abb 100644
--- a/Detail.c
+++ b/Detail.c
@@ -195,7 +195,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
 		if (array.level >= 1) {
 			if (array.major_version != 0 &&
 			    (larray_size >= 0xFFFFFFFFULL|| array.size == 0)) {
-				unsigned long long dsize = get_component_size(fd);
+				unsigned long long dsize = get_component_size(fd) / 2; /* KB */
 				if (dsize > 0)
 					printf("  Used Dev Size : %llu%s\n",
 					       dsize,
-- 
The only person who always got his work done by Friday was Robinson Crusoe

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux