All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: LVM2 lib/metadata/lv_manip.c lib/metadata/meta ...
Date: Thu, 07 Apr 2011 14:09:49 +0200	[thread overview]
Message-ID: <4D9DA98D.2000007@redhat.com> (raw)
In-Reply-To: <20110406213222.10912.qmail@sourceware.org>

Dne 6.4.2011 23:32, jbrassow at sourceware.org napsal(a):
> CVSROOT:	/cvs/lvm2
> Module name:	LVM2
> Changes by:	jbrassow at sourceware.org	2011-04-06 21:32:21
> 
> Modified files:
> 	lib/metadata   : lv_manip.c metadata-exported.h mirror.c 
> 	tools          : lvresize.c 
> 
> Log message:
> 	This patch adds the ability to extend 0 length layered LVs.  This
> 	allows us to allocate all images of a mirror (or RAID array) at one
> 	time during create.
> 	
> 	The current mirror implementation still requires a separate allocation
> 	for the log, however.
> 
> Patches:
> http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.254&r2=1.255
> http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.188&r2=1.189
> http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.146&r2=1.147
> http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.129&r2=1.130
> 
> --- LVM2/lib/metadata/lv_manip.c	2011/03/29 20:19:04	1.254
> +++ LVM2/lib/metadata/lv_manip.c	2011/04/06 21:32:20	1.255
> @@ -2106,29 +2106,87 @@
>  			      0, status, 0);
>  }
>  
> -static int _lv_extend_mirror(struct alloc_handle *ah,
> -			     struct logical_volume *lv,
> -			     uint32_t extents, uint32_t first_area,
> -			     uint32_t stripes, uint32_t stripe_size)
> +static int _lv_insert_empty_sublvs(struct logical_volume *lv,
> +				   const struct segment_type *segtype,
> +				   uint32_t region_size,
> +				   uint32_t devices)
> +{
> +	struct logical_volume *sub_lv;
> +	uint32_t i;
> +	uint64_t status = 0;
> +	char *img_name;
> +	size_t len;
> +	struct lv_segment *mapseg;
> +
> +	if (lv->le_count || first_seg(lv)) {
> +		log_error(INTERNAL_ERROR
> +			  "Non-empty LV passed to _lv_insert_empty_sublv");
> +		return 0;
> +	}
> +
> +	if (!segtype_is_mirrored(segtype))
> +		return_0;
> +	lv->status |= MIRRORED;
> +
> +	/*
> +	 * First, create our top-level segment for our top-level LV
> +	 */
> +	if (!(mapseg = alloc_lv_segment(lv->vg->cmd->mem, segtype,
> +					lv, 0, 0, lv->status, 0, NULL,
> +					devices, 0, 0, region_size, 0, NULL))) {
> +		log_error("Failed to create mapping segment for %s", lv->name);
> +		return 0;
> +	}
> +
> +	/*
> +	 * Next, create all of our sub_lv's and link them in.
> +	 */
> +	len = strlen(lv->name) + 32;
> +	if (!(img_name = dm_pool_alloc(lv->vg->cmd->mem, len)))
> +		return_0;
> +	if (dm_snprintf(img_name, len, "%s%s", lv->name, "_mimage_%d") < 0)
> +		return_0;
> +
> +	for (i = 0; i < devices; i++) {
> +		sub_lv = lv_create_empty(img_name, NULL,
> +					 MIRROR_IMAGE, lv->alloc, lv->vg);
> +		if (!sub_lv)
> +			return_0;
> +		if (!set_lv_segment_area_lv(mapseg, i, sub_lv, 0, status))
> +			return_0;
> +	}
> +	dm_list_add(&lv->segments, &mapseg->list);
> +
> +	dm_pool_free(lv->vg->cmd->mem, img_name);


Aren't you experiencing random crashes with this  dm_pool_free() ?
It removes also all objects allocated past this img_name.
(Also I think there is already an internal function for building such names)

Zdenek



  reply	other threads:[~2011-04-07 12:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06 21:32 LVM2 lib/metadata/lv_manip.c lib/metadata/meta jbrassow
2011-04-07 12:09 ` Zdenek Kabelac [this message]
2011-04-07 15:20   ` Jonathan Brassow
2011-04-07 20:35     ` Zdenek Kabelac
2011-04-07 21:36       ` Jonathan Brassow
  -- strict thread matches above, loose matches on Subject: below --
2009-07-26  2:33 wysochanski
2008-08-05 12:05 zkabelac
2008-01-17 13:54 agk
2008-01-17 13:13 agk
2007-12-20 22:37 agk
2007-10-11 19:20 wysochanski
2007-09-24 21:30 wysochanski
2007-08-21 16:40 wysochanski

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=4D9DA98D.2000007@redhat.com \
    --to=zkabelac@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.