Re: [PATCH] add missing units to --examine

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

 



On 2019-02-13 12:06, Jes Sorensen wrote:
On 2/11/19 8:42 PM, bugfood-ml@xxxxxxxxxx wrote:
From: Corey Hickey <bugfood-c@xxxxxxxxxx>

Within the output of "mdadm --examine", there are three sizes reported
on adjacent lines. For example:

$ sudo mdadm --examine /dev/md3
[...]
  Avail Dev Size : 17580545024 (8383.06 GiB 9001.24 GB)
      Array Size : 17580417024 (16765.99 GiB 18002.35 GB)
   Used Dev Size : 11720278016 (5588.66 GiB 6000.78 GB)
[...]

This can be confusing, since the first and third line are in 512-byte
sectors, and the second is in KiB.

Add units to avoid ambiguity.

(I don't particularly like the "KiB" notation, but it is at least
unambiguous.)

Signed-off-by: Corey Hickey <bugfood-c@xxxxxxxxxx>
---
  super1.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/super1.c b/super1.c
index 636a286..b85dc20 100644
--- a/super1.c
+++ b/super1.c
@@ -360,7 +360,7 @@ static void examine_super1(struct supertype *st, char *homehost)
  	printf("     Raid Level : %s\n", c?c:"-unknown-");
  	printf("   Raid Devices : %d\n", __le32_to_cpu(sb->raid_disks));
  	printf("\n");
-	printf(" Avail Dev Size : %llu%s\n",
+	printf(" Avail Dev Size : %llu sectors%s\n",

The alignment here is messed up, you need a space before the %s?

I would have expected that too, but the %s is filled by human_size(), which has a built-in leading space already:

    snprintf(buf, sizeof(buf), " (%ld.%02ld GiB %ld.%02ld GB)",

For example:

$ sudo /usr/local/src/mdadm/mdadm --examine /dev/md3 | grep Avail
 Avail Dev Size : 11720278016 sectors (5588.66 GiB 6000.78 GB)


Is that ok, or am I misunderstanding this?

Thanks,
Corey



[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