linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andre Noll <maan@systemlinux.org>
To: Peter Rabbitson <rabbit+list@rabbit.us>
Cc: LinuxRaid <linux-raid@vger.kernel.org>
Subject: Re: [PATCH 0/2] md: More block -> sector conversions.
Date: Mon, 26 Jan 2009 19:33:59 +0100	[thread overview]
Message-ID: <20090126183359.GG17185@skl-net.de> (raw)
In-Reply-To: <497DF230.1080908@rabbit.us>

[-- Attachment #1: Type: text/plain, Size: 1393 bytes --]

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2009-01-26 18:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-26 15:14 [PATCH 0/2] md: More block -> sector conversions Andre Noll
2009-01-26 15:14 ` [PATCH 1/2] md: Make mddev->size sector-based Andre Noll
2009-01-26 15:14 ` [PATCH 2/2] md: Represent raid device size in sectors Andre Noll
2009-01-26 15:31 ` [PATCH 0/2] md: More block -> sector conversions Peter Rabbitson
2009-01-26 16:08   ` Andre Noll
2009-01-26 17:26     ` Peter Rabbitson
2009-01-26 18:33       ` Andre Noll [this message]
2009-01-27  7:52         ` [PATCH] mdadm: Fix the used device size in mdadm -D output Andre Noll
2009-02-01 23:04           ` Neil Brown
2009-01-27  6:39 ` [PATCH 0/2] md: More block -> sector conversions Neil Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090126183359.GG17185@skl-net.de \
    --to=maan@systemlinux.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=rabbit+list@rabbit.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).