linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: John Brooks <john@fastquake.com>, linux-raid@vger.kernel.org
Subject: Re: Inconsistent use of sectors vs 1k-blocks in sysfs and other places
Date: Wed, 21 Dec 2016 11:06:53 +1100	[thread overview]
Message-ID: <87h95yrvqa.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20161220221430.GA19146@oldkitsune.fastquake.com>

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

On Wed, Dec 21 2016, John Brooks wrote:

> On Mon, Dec 19, 2016 at 09:32:00AM +1100, NeilBrown wrote:
>> The code is right by definition.  As you say, mdadm uses this interface
>> so we cannot change it.
>
> Yep, I expected as much and fully agree.
>
>> >
>> > Somewhat related, suspend_{lo|hi}, resync_{min|max} attributes specify ranges
>> > in sectors, but the documentation does not specify if they are ranges on the
>> > array size or device size. And RAID10 may even handle resync_max differently
>> > from the rest; I didn't look deeply into that but see commit c805cdecea.
>>
>> suspend_{lo|hi} are are array addresses
>> resync_{min|max} are array addresses for RAID1 and RAID10, and they are
>> device-addresses-offset-from-data_offset for RAID1 and RAID456.
>
> Good to know. One question, is it possible for the offset or size to be
> different across disks in the same array? The documentation says that the size
> is "normally" the same as component_size, implying that perhaps it could be
> different.

raid0 and linear are special.
For linear, it is obvious that differently sized devices can be
combined.
For raid0, it is not quite so obvious.  The array is divided into
region.  The first region is striped over all devices.  Then next region
is striped over all devices that are bigger than the smallest, etc.

The offset can be different on all devices.  The size can be only for
raid0 and linear.

>
>> It is bad that the documentation is incorrect and incomplete.  If you we
>> to post a patch which fixed some of it, I'm sure that would be
>> thankfully accepted.
>
> I will see what I can do.
>
>> In theory you could have a RAID1 with an odd number of sectors used in
>> each component, but I doubt that happens in practice.  So you can get
>> the component size in sectors by reading component_size and multiplying
>> by two.
>
> Is that within a realm of possibility worth mentioning in the docs?

Probably not.  I'd have to check the code to see what it actually
allows.
If the kernel allows odd-sized RAID1, we would have to leave it that
way.  But I'd support changing mdadm (if needed) to refuse to create
a RAID1 with an odd number of sectors (or even a size that is not a
multiple of 4K).

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

      reply	other threads:[~2016-12-21  0:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-17  5:14 Inconsistent use of sectors vs 1k-blocks in sysfs and other places John Brooks
2016-12-18 22:32 ` NeilBrown
2016-12-20 22:14   ` John Brooks
2016-12-21  0:06     ` NeilBrown [this message]

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=87h95yrvqa.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=john@fastquake.com \
    --cc=linux-raid@vger.kernel.org \
    /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).