* [PATCH] imsm: show correct size for arrays with 4k disks
@ 2017-01-09 14:16 Maksymilian Kunt
2017-01-09 14:26 ` Jes Sorensen
0 siblings, 1 reply; 2+ messages in thread
From: Maksymilian Kunt @ 2017-01-09 14:16 UTC (permalink / raw)
To: linux-raid; +Cc: jes.sorensen, Maksymilian Kunt
Number of blocks used to calculate array size is based on 512 block size
so the size displayed is incorrect for arrays with 4k disks.
Signed-off-by: Maksymilian Kunt <maksymilian.kunt@intel.com>
---
super-intel.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index 0817a1f..87ed8ec 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1480,8 +1480,10 @@ static void print_imsm_dev(struct intel_super *super,
printf(" Dirty State : %s\n", dev->vol.dirty ? "dirty" : "clean");
}
-static void print_imsm_disk(struct imsm_disk *disk, int index, __u32 reserved)
-{
+static void print_imsm_disk(struct imsm_disk *disk,
+ int index,
+ __u32 reserved,
+ unsigned int sector_size) {
char str[MAX_RAID_SERIAL_LEN + 1];
__u64 sz;
@@ -1499,7 +1501,8 @@ static void print_imsm_disk(struct imsm_disk *disk, int index, __u32 reserved)
is_failed(disk) ? " failed" : "");
printf(" Id : %08x\n", __le32_to_cpu(disk->scsi_id));
sz = total_blocks(disk) - reserved;
- printf(" Usable Size : %llu%s\n", (unsigned long long)sz,
+ printf(" Usable Size : %llu%s\n",
+ (unsigned long long)sz * 512 / sector_size,
human_size(sz * 512));
}
@@ -1829,7 +1832,8 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
printf(" MPB Sectors : %d\n", mpb_sectors(mpb, super->sector_size));
printf(" Disks : %d\n", mpb->num_disks);
printf(" RAID Devices : %d\n", mpb->num_raid_devs);
- print_imsm_disk(__get_imsm_disk(mpb, super->disks->index), super->disks->index, reserved);
+ print_imsm_disk(__get_imsm_disk(mpb, super->disks->index),
+ super->disks->index, reserved, super->sector_size);
if (get_imsm_bbm_log_size(super->bbm_log)) {
struct bbm_log *log = super->bbm_log;
@@ -1851,12 +1855,14 @@ static void examine_super_imsm(struct supertype *st, char *homehost)
for (i = 0; i < mpb->num_disks; i++) {
if (i == super->disks->index)
continue;
- print_imsm_disk(__get_imsm_disk(mpb, i), i, reserved);
+ print_imsm_disk(__get_imsm_disk(mpb, i), i, reserved,
+ super->sector_size);
}
for (dl = super->disks; dl; dl = dl->next)
if (dl->index == -1)
- print_imsm_disk(&dl->disk, -1, reserved);
+ print_imsm_disk(&dl->disk, -1, reserved,
+ super->sector_size);
examine_migr_rec_imsm(super);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] imsm: show correct size for arrays with 4k disks
2017-01-09 14:16 [PATCH] imsm: show correct size for arrays with 4k disks Maksymilian Kunt
@ 2017-01-09 14:26 ` Jes Sorensen
0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2017-01-09 14:26 UTC (permalink / raw)
To: Maksymilian Kunt; +Cc: linux-raid
Maksymilian Kunt <maksymilian.kunt@intel.com> writes:
> Number of blocks used to calculate array size is based on 512 block size
> so the size displayed is incorrect for arrays with 4k disks.
>
> Signed-off-by: Maksymilian Kunt <maksymilian.kunt@intel.com>
> ---
> super-intel.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
Applied!
Thanks,
Jes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-09 14:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-09 14:16 [PATCH] imsm: show correct size for arrays with 4k disks Maksymilian Kunt
2017-01-09 14:26 ` Jes Sorensen
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).