From: Mike Snitzer <snitzer@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 1/2] Always query device by uuid only.
Date: Tue, 23 Feb 2010 15:39:02 -0500 [thread overview]
Message-ID: <20100223203902.GA31973@redhat.com> (raw)
In-Reply-To: <1266932816-5621-1-git-send-email-mbroz@redhat.com>
On Tue, Feb 23 2010 at 8:46am -0500,
Milan Broz <mbroz@redhat.com> wrote:
> lvm2 devices have always UUID set even if imported from lvm1 metadata.
>
> Patch removes name argument from dev_manager_info call and converts
> all activation related calls to use query by UUID.
>
> Also it simplifies mknode call (which is the only user on mknodes parameter).
Looks good, I have few questions though.
> diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
> index bbf95a3..84f94ff 100644
> --- a/lib/activate/dev_manager.c
> +++ b/lib/activate/dev_manager.c
> @@ -235,20 +237,29 @@ static int _info_by_dev(uint32_t major, uint32_t minor, struct dm_info *info)
> return _info_run(NULL, NULL, info, NULL, 0, 0, 0, major, minor);
> }
>
> -int dev_manager_info(struct dm_pool *mem, const char *name,
> - const struct logical_volume *lv, int with_mknodes,
> - int with_open_count, int with_read_ahead,
> +int dev_manager_info(struct dm_pool *mem, const struct logical_volume *lv,
> + int with_mknodes, int with_open_count, int with_read_ahead,
> struct dm_info *info, uint32_t *read_ahead)
> {
> - const char *dlid;
> + const char *dlid, *name;
> + int r;
> +
> + if (!(name = build_dm_name(mem, lv->vg->name, lv->name, NULL))) {
> + log_error("name build failed for %s", lv->name);
> + return 0;
> + }
>
> if (!(dlid = _build_dlid(mem, lv->lvid.s, NULL))) {
> log_error("dlid build failed for %s", lv->name);
> return 0;
> }
>
> - return _info(name, dlid, with_mknodes, with_open_count, with_read_ahead,
> - info, read_ahead);
> + log_debug("Getting device info for %s", name);
> + r = _info(NULL, dlid, with_mknodes, with_open_count,
> + with_read_ahead, info, read_ahead);
> +
> + dm_pool_free(mem, (char*)name);
> + return r;
> }
So the debugging benefit of having 'name' here outweighs the (small)
cost of build_dm_name/dm_pool_free? Really not a big deal but figured
I'd ask.
Also, _add_dev_to_dtree() is the only remaining caller of _info() that
passes 'name'. Passing a NULL 'name' to _info() from _add_dev_to_dtree()
still allows the testsuite to pass. What are the benefit(s) of
preserving _info()'s info-by-name fallback for _add_dev_to_dtree()?
Mike
next prev parent reply other threads:[~2010-02-23 20:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-23 13:46 [PATCH 1/2] Always query device by uuid only Milan Broz
2010-02-23 13:46 ` [PATCH 2/2] Remove lvs_in_vg_activated_by_uuid_only call Milan Broz
2010-02-23 20:39 ` Mike Snitzer [this message]
2010-02-24 11:46 ` [PATCH 1/2] Always query device by uuid only Milan Broz
2010-02-24 11:56 ` Milan Broz
2010-02-24 12:55 ` Milan Broz
2010-02-24 14:02 ` Mike Snitzer
2010-02-24 15:41 ` Petr Rockai
2010-02-24 15:39 ` Petr Rockai
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=20100223203902.GA31973@redhat.com \
--to=snitzer@redhat.com \
--cc=lvm-devel@redhat.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 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.