linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Doug Ledford <dledford@redhat.com>
To: "Hawrylewicz Czarnowski,
	Przemyslaw" <przemyslaw.hawrylewicz.czarnowski@intel.com>
Cc: Neil Brown <neilb@suse.de>,
	"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 1/2] imsm: delete subarray functionality
Date: Thu, 01 Apr 2010 12:41:34 -0400	[thread overview]
Message-ID: <4BB4CCBE.90902@redhat.com> (raw)
In-Reply-To: <66C59AD0932712458090B447266D638CD3C7EAF4@irsmsx504.ger.corp.intel.com>

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

On 03/31/2010 04:50 PM, Hawrylewicz Czarnowski, Przemyslaw wrote:
> Patch also adds some utilities

One of which I see as being useful outside of the scope that you have
envisioned:

> diff --git a/mdstat.c b/mdstat.c
> index 4a9f370..bb6179d 100644
> --- a/mdstat.c
> +++ b/mdstat.c

This is a generic file and routines in this code should be generic, not
specific to a supertype.

> +
> +/*
> + * Finds name of the active array holding this device
> + * @param[in]  devname         name of member device
> + * @param[out] devname         name of array
> + *
> + * @return                     found (0), or
> + *                             not found, failure (1)
> + */
> +
> +int mdstat_check_active(char *devname)
> +{
> +       struct mdstat_ent *mdstat = mdstat_read(0, 0);
> +       struct mdstat_ent *ent;
> +       char *name;
> +
> +       if (!devname)
> +               return 1;
> +       name = strrchr(devname, '/');
> +       if (name++ == NULL)
> +               return 1;
> +
> +       for (ent = mdstat; ent; ent = ent->next) {
> +               struct dev_member *m;
> +               if (ent->active) /* only containers */
> +                       continue;
> +               for (m = ent->members; m; m = m->next) {
> +                       if (!strcmp(m->name, name)) {
> +                               strcpy(devname, ent->dev);
> +                               return 0;
> +                       }
> +               }
> +       }
> +       return 1;
> +}

This in particular is useful for things other than just looking up
containers.  It is useful for finding either native or external metadata
based arrays that have a specific device in them.  I will probably snag
this for my code, but change it so that it is generic.

-- 
Doug Ledford <dledford@redhat.com>
              GPG KeyID: CFBFF194
	      http://people.redhat.com/dledford

Infiniband specific RPMs available at
	      http://people.redhat.com/dledford/Infiniband


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

      parent reply	other threads:[~2010-04-01 16:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-31 20:50 [PATCH 1/2] imsm: delete subarray functionality Hawrylewicz Czarnowski, Przemyslaw
2010-04-01  6:09 ` Luca Berra
2010-04-01 16:31   ` Doug Ledford
2010-04-01 21:31     ` Hawrylewicz Czarnowski, Przemyslaw
2010-04-02  5:36       ` Neil Brown
2010-04-01 21:29   ` Hawrylewicz Czarnowski, Przemyslaw
2010-04-01 16:41 ` Doug Ledford [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=4BB4CCBE.90902@redhat.com \
    --to=dledford@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=przemyslaw.hawrylewicz.czarnowski@intel.com \
    /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).