All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rajnoha <prajnoha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 16/17] Fix pvchange -u to work with recent changes in metadata handling interface.
Date: Mon, 24 Jan 2011 17:04:17 +0100	[thread overview]
Message-ID: <4D3DA301.2090303@redhat.com> (raw)
In-Reply-To: <1295867048-21558-17-git-send-email-prajnoha@redhat.com>

On 01/24/2011 12:04 PM +0100, Peter Rajnoha wrote:
> I use PV id as a key for format instance's metadata_areas_index.
> But since we change this one, I still need to work with the original
> one to access the metadata areas (e.g. in pv_write). So, I defined
> the pv->old_id to store that.

One more thing to note. We should probably allow writing non-orphan
PVs directly... The pv_write code calls:

    /* Add a new cache entry with PV info or update existing one. */
        if (!(info = lvmcache_add(fmt->labeller, (const char *) &pv->id,   
                        pv->dev, FMT_TEXT_ORPHAN_VG_NAME, NULL, 0)))
                return_0;

..that changes any existing cache entry to be "orphaned", even if that
PV is already part of a VG!

The code concerned is in outer pv_write fn that calls format specific
pv_write code:

        if (!is_orphan_vg(pv->vg_name) || pv->pe_alloc_count) {
                log_error("Assertion failed: can't _pv_write non-orphan PV "
                          "(in VG %s)", pv->vg_name);
                return 0;
        }

Also, the pvchange -u call is not quite nice today:


          pv->vg_name = pv->fmt->orphan_vg_name;
          pv->pe_alloc_count = 0;
          if (!(pv_write(cmd, pv))) {
                      log_error("pv_write with new uuid failed "
                                          "for %s.", pv_name);
                      goto out;
          }
          pv->vg_name = orig_vg_name;
          pv->pe_alloc_count = orig_pe_alloc_count;


To support calling pv_write on non-orphan PVs, we need to destroy
the old cache item and insert a new one or just update the existing
cache entry. But since the pvid is used as a key to cache pvid hash,
we need to update this entry as well... But I don't see that as a
problem. The change is quite easy, the question is whether it won't
cause any other problems...

Peter



  reply	other threads:[~2011-01-24 16:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 11:03 [PATCH 00/17] Add interface to support adding and removing metadata areas on demand (v2) Peter Rajnoha
2011-01-24 11:03 ` [PATCH 01/17] Add pvid parameter to create_instance function Peter Rajnoha
2011-01-25 12:54   ` Petr Rockai
2011-01-24 11:03 ` [PATCH 02/17] Add supporting functions for metadata areas stored in format instance Peter Rajnoha
2011-01-25 13:16   ` Petr Rockai
2011-01-26 10:38     ` Peter Rajnoha
2011-01-26 13:59       ` Petr Rockai
2011-01-26 14:06       ` Petr Rockai
2011-01-24 11:03 ` [PATCH 03/17] Add struct format_instance *fid field to struct physical_volume Peter Rajnoha
2011-01-25 13:03   ` Petr Rockai
2011-01-24 11:03 ` [PATCH 04/17] Add format_instance support for pv_read Peter Rajnoha
2011-01-25 13:30   ` Petr Rockai
2011-01-26 11:05     ` Peter Rajnoha
2011-01-26 11:12       ` Peter Rajnoha
2011-01-24 11:03 ` [PATCH 05/17] Add attach_existing_mdas parameter to create_instance fn Peter Rajnoha
2011-01-25 14:43   ` Petr Rockai
2011-01-26 13:24     ` Peter Rajnoha
2011-01-24 11:03 ` [PATCH 06/17] Remove useless mdas parameter from PV read functions Peter Rajnoha
2011-01-25 14:44   ` Petr Rockai
2011-01-24 11:03 ` [PATCH 07/17] Add pv_add_metadata_area fn to support adding metadata areas on demand Peter Rajnoha
2011-01-25 14:48   ` Petr Rockai
2011-01-24 11:03 ` [PATCH 08/17] Add pv_remove_metadata_area fn to support removing " Peter Rajnoha
2011-01-28 15:31   ` Petr Rockai
2011-01-24 11:04 ` [PATCH 09/17] Add pv_initialise fn to format_handler interface Peter Rajnoha
2011-01-28 16:31   ` Petr Rockai
2011-01-24 11:04 ` [PATCH 10/17] Add pe_start_locked parameter to pv_create fn Peter Rajnoha
2011-01-28 16:39   ` Petr Rockai
2011-01-24 11:04 ` [PATCH 11/17] Refactor pv_setup to not include the PV initialisation code Peter Rajnoha
2011-01-24 11:04 ` [PATCH 12/17] Remove unused _mda_setup code Peter Rajnoha
2011-01-24 11:04 ` [PATCH 13/17] Cleanup pv_write code to use recent changes in metadata handling interface Peter Rajnoha
2011-01-24 11:04 ` [PATCH 14/17] Use new metadata handling interface to provide better support for PV resize Peter Rajnoha
2011-01-24 11:04 ` [PATCH 15/17] Change vg_convert code to actually work with recent changes in metadata handling interface Peter Rajnoha
2011-01-24 11:04 ` [PATCH 16/17] Fix pvchange -u to " Peter Rajnoha
2011-01-24 16:04   ` Peter Rajnoha [this message]
2011-01-24 11:04 ` [PATCH 17/17] Fix pvchange --metadataignore " Peter Rajnoha
2011-01-24 11:12 ` [PATCH 00/17] Add interface to support adding and removing metadata areas on demand (v2) Peter Rajnoha

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=4D3DA301.2090303@redhat.com \
    --to=prajnoha@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.