All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Rockai <prockai@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 08/17] Add pv_remove_metadata_area fn to support removing metadata areas on demand.
Date: Fri, 28 Jan 2011 16:31:01 +0100	[thread overview]
Message-ID: <87sjwdoxje.fsf@twilight.int.mornfall.net.> (raw)
In-Reply-To: <1295867048-21558-9-git-send-email-prajnoha@redhat.com> (Peter Rajnoha's message of "Mon, 24 Jan 2011 12:03:59 +0100")

Peter Rajnoha <prajnoha@redhat.com> writes:

> The same as for pv_add_metadata_area, but removing...
These look OK (although the FMT_TEXT_MAX_MDAS_PER_PV is a bit fiddly).

> Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>

> ---
>  lib/format_text/format-text.c |   24 ++++++++++++++++++++++++
>  lib/format_text/format-text.h |    2 ++
>  lib/metadata/metadata.h       |    7 +++++++
>  3 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
> index cf18f25..99f691f 100644
> --- a/lib/format_text/format-text.c
> +++ b/lib/format_text/format-text.c
> @@ -2275,6 +2275,29 @@ bad:
>  	return 0;
>  }
>  
> +int remove_metadata_area_from_pv(struct physical_volume *pv,
> +				 unsigned mda_index)
> +{
> +	if (mda_index >= FMT_TEXT_MAX_MDAS_PER_PV) {
> +		log_error(INTERNAL_ERROR "can't remove metadata area with "
> +					 "index %u from PV %s. Metadata "
> +					 "layou not supported by %s format.",
> +					  mda_index, dev_name(pv->dev),
> +					  pv->fmt->name);
> +		return 0;
> +	}
> +
> +	return fid_remove_mda(pv->fid, NULL, (const char *) &pv->id,
> +			      ID_LEN, mda_index);
> +}
> +
> +static int _text_pv_remove_metadata_area(const struct format_type *fmt,
> +					 struct physical_volume *pv,
> +					 unsigned mda_index)
> +{
> +	return remove_metadata_area_from_pv(pv, mda_index);
> +}
> +
>  /* NULL vgname means use only the supplied context e.g. an archive file */
>  static struct format_instance *_text_create_text_instance(const struct format_type *fmt,
>  							  const char *pvid,
> @@ -2356,6 +2379,7 @@ static struct format_handler _text_handler = {
>  	.pv_read = _text_pv_read,
>  	.pv_setup = _text_pv_setup,
>  	.pv_add_metadata_area = _text_pv_add_metadata_area,
> +	.pv_remove_metadata_area = _text_pv_remove_metadata_area,
>  	.pv_write = _text_pv_write,
>  	.vg_setup = _text_vg_setup,
>  	.lv_setup = _text_lv_setup,
> diff --git a/lib/format_text/format-text.h b/lib/format_text/format-text.h
> index f65be74..694b5c1 100644
> --- a/lib/format_text/format-text.h
> +++ b/lib/format_text/format-text.h
> @@ -61,6 +61,8 @@ int add_metadata_area_to_pv(struct physical_volume *pv,
>  			    uint64_t mda_start,
>  			    uint64_t mda_size,
>  			    unsigned mda_ignored);
> +int remove_metadata_area_from_pv(struct physical_volume *pv,
> +				 unsigned mda_index);
>  int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *mdas,
>  	    struct device *dev, uint64_t start, uint64_t size, unsigned ignored);
>  void del_mdas(struct dm_list *mdas);
> diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
> index 0da8b3d..ed72551 100644
> --- a/lib/metadata/metadata.h
> +++ b/lib/metadata/metadata.h
> @@ -266,6 +266,13 @@ struct format_handler {
>  				     unsigned metadata_ignored);
>  
>  	/*
> +	 * Remove metadata area from a PV. Changes will take effect on pv_write.
> +	 */
> +	int (*pv_remove_metadata_area) (const struct format_type *fmt,
> +					struct physical_volume *pv,
> +					unsigned metadata_index);
> +
> +	/*
>  	 * Write a PV structure to disk. Fails if the PV is in a VG ie
>  	 * pv->vg_name must be a valid orphan VG name
>  	 */



  reply	other threads:[~2011-01-28 15:31 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 [this message]
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
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=87sjwdoxje.fsf@twilight.int.mornfall.net. \
    --to=prockai@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.