From: Neil Brown <neilb@suse.de>
To: "Kwolek, Adam" <adam.kwolek@intel.com>
Cc: "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
"Williams, Dan J" <dan.j.williams@intel.com>,
"Ciechanowski, Ed" <ed.ciechanowski@intel.com>
Subject: Re: [PATCH 03/27] imsm: Prepare reshape_update in mdadm
Date: Thu, 9 Dec 2010 09:05:58 +1100 [thread overview]
Message-ID: <20101209090558.32f48daa@notabene.brown> (raw)
In-Reply-To: <905EDD02F158D948B186911EB64DB3D17676EAED@irsmsx503.ger.corp.intel.com>
On Wed, 8 Dec 2010 13:51:27 +0000 "Kwolek, Adam" <adam.kwolek@intel.com>
wrote:
> I didn't describe those functions, because I've realized that it has to be changed after your email.
> I've planned to do this before I send patches, but unfortunately this "thread" was missed before sending ;).
> Here is current state.
>
> Functions:
> - path2devnum() (Translates path (or symbolic link) to md device given by user to device number.)
> - find_array_minor() (returns device minor for given array name, it uses maps to find names with additions (i.e. "_0") from assebbly)
> - find_array_minor2() (as find_array_minor() but works for frozen arrays also)
>
> Will be removed and replaced by:
>
> int find_array_minor_by_subdev(int subdev, int container, int *minor)
> {
> char text_version[PATH_MAX];
> char path[PATH_MAX];
> int i;
> struct stat s;
>
> sprintf(text_version, "md%i/%i", container, subdev);
> for (i = 127; i >= 0; i--) {
> char buf[PATH_MAX];
>
> snprintf(path, PATH_MAX, "/sys/block/md%d/md/", i);
> if (stat(path, &s) != -1) {
> char *version;
>
> strcat(path, "metadata_version");
> if (load_sys(path, buf))
> continue;
> version = strchr(buf, ':');
> /* compare without first letter
> * it could be marked as frozen with '-'
> */
> if (!version || strcmp(version + 2, text_version))
> continue;
> *minor = i;
> return 0;
> }
> }
>
> return -1;
> }
>
> This is a little part of find_array_minor() with changed input.
>
> This function searches given container for subdev and returns it minor id.
> i.e.: for input parameters 0 and 127 it creates search string i.e. "md127/0" and for such device returns minor (~126).
> For success 0 is returned, and -1 for failure (and passed minor variable remains untouched).
> It searches all devices from 127 to 0.
> I think it is simpler now (as you raised this issue), and mdadm doesn't make decisions based on array name/string/ now.
>
> Please let me know how do you find this change.
Yes much simpler and better. And I understand easily what you are trying to
do which is also good!
There are two problems:
1/ it assumes that subdevs have a number. I would prefer that generic code
assumed that a subdev has a name - if that happens to always be a numeric
name, that is up to the metadata handler.
2/ searching from 127 to 0 is wrong because md number can be much bigger than
127 if you have enough devices. It would be better to use readdir to get a
list of the /sys/block/mdXX that actually exist.
However I would rather not uses sysfs at all, but mdstat as that is easy to
read and search quickly.
Have a look at mdstat_by_component. Write something similar which is given a
container and subarray name and returns the corresponding mdstat_ent.
That would be much cleaner and even simpler.
>
> I've replaced open() with open_dev() in this patch (and in a few next one: 0003, 0007, 0012, 0019, 0021)
>
> If it is ok, please let me know if you want fresh series or you'll apply current one and I'll send patches for above changes then.
> In future patches, I'll address problem with lines longer than 80 characters also.
Please always send a series of patches against what you pull from my
devel-3.2 branch. I'll fix up any conflicts against anything I might have
committed since you pulled.
It is probably best to send smallish sets of patches - maybe about 10 at a
time. If they are accepted, you can send the next batch. If there are
issues, you can revise subsequent patches before you send them.
NeilBrown
>
> Please note also that implementation of searching spare devices for reshape is not final.
> It requires better integration with auto-rebuild searching spares mechanism.
> This task is in my nearest plans (I'm hoping to post fixes instead of whole series again ;))
>
>
> BR
> Adam
>
next prev parent reply other threads:[~2010-12-08 22:05 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-06 13:20 [PATCH 00/27] OLCE, migrations and raid10 takeover Adam Kwolek
2010-12-06 13:20 ` [PATCH 01/27] FIX: wait_backup() sometimes hangs Adam Kwolek
2010-12-06 13:21 ` [PATCH 02/27] Add state_of_reshape for external metadata Adam Kwolek
2010-12-06 13:21 ` [PATCH 03/27] imsm: Prepare reshape_update in mdadm Adam Kwolek
2010-12-08 3:10 ` Neil Brown
2010-12-08 14:18 ` Kwolek, Adam
2010-12-08 22:05 ` Neil Brown [this message]
2010-12-09 8:42 ` Suspend_hi mamagment during reshape Kwolek, Adam
2010-12-09 10:28 ` Neil Brown
2010-12-09 15:59 ` Kwolek, Adam
2010-12-09 16:08 ` Kwolek, Adam
2010-12-06 13:21 ` [PATCH 04/27] imsm: Process reshape_update in mdmon Adam Kwolek
2010-12-06 13:21 ` [PATCH 05/27] imsm: Block array state change during reshape Adam Kwolek
2010-12-06 13:21 ` [PATCH 06/27] Process reshape initialization by managemon Adam Kwolek
2010-12-06 13:21 ` [PATCH 07/27] imsm: Verify slots in meta against slot numbers set by md Adam Kwolek
2010-12-06 13:21 ` [PATCH 08/27] imsm: Cancel metadata changes on reshape start failure Adam Kwolek
2010-12-06 13:21 ` [PATCH 09/27] imsm: Do not accept messages sent by mdadm Adam Kwolek
2010-12-06 13:22 ` [PATCH 10/27] imsm: Do not indicate resync during reshape Adam Kwolek
2010-12-06 13:22 ` [PATCH 11/27] imsm: Fill delta_disks field in getinfo_super() Adam Kwolek
2010-12-06 13:22 ` [PATCH 12/27] Control reshape in mdadm Adam Kwolek
2010-12-06 13:22 ` [PATCH 13/27] Finalize reshape after adding disks to array Adam Kwolek
2010-12-06 13:22 ` [PATCH 14/27] Add reshape progress updating Adam Kwolek
2010-12-06 13:22 ` [PATCH 15/27] WORKAROUND: md reports idle state during reshape start Adam Kwolek
2010-12-06 13:22 ` [PATCH 16/27] FIX: core during getting map Adam Kwolek
2010-12-06 13:22 ` [PATCH 17/27] Enable reshape for subarrays Adam Kwolek
2010-12-06 13:23 ` [PATCH 18/27] Change manage_reshape() placement Adam Kwolek
2010-12-06 13:23 ` [PATCH 19/27] Migration: raid5->raid0 Adam Kwolek
2010-12-06 13:23 ` [PATCH 20/27] Detect level change Adam Kwolek
2010-12-06 13:23 ` [PATCH 21/27] Migration raid0->raid5 Adam Kwolek
2010-12-06 13:23 ` [PATCH 22/27] Read chunk size and layout from mdstat Adam Kwolek
2010-12-06 13:23 ` [PATCH 23/27] Migration: Chunk size migration Adam Kwolek
2010-12-06 13:23 ` [PATCH 24/27] Add takeover support for external meta Adam Kwolek
2010-12-06 13:24 ` [PATCH 25/27] Takeover raid10 -> raid0 for external metadata Adam Kwolek
2010-12-06 13:24 ` [PATCH 26/27] Takeover raid0 -> raid10 " Adam Kwolek
2010-12-06 13:24 ` [PATCH 27/27] FIX: Problem with removing array after takeover Adam Kwolek
2010-12-07 10:18 ` [PATCH 00/27] OLCE, migrations and raid10 takeover 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=20101209090558.32f48daa@notabene.brown \
--to=neilb@suse.de \
--cc=adam.kwolek@intel.com \
--cc=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.