public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: zkabelac@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 lib/metadata/lv_manip.c tools/lvresize.c
Date: Fri, 28 Oct 2011 20:31:00 -0000	[thread overview]
Message-ID: <20111028203102.9052.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-28 20:31:01

Modified files:
	lib/metadata   : lv_manip.c 
	tools          : lvresize.c 

Log message:
	Thin pool resize support for data LV
	
	Support for extension of pool data LV.
	
	TODO: figure out thin volume for suspend/resume in cluster.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.310&r2=1.311
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.139&r2=1.140

--- LVM2/lib/metadata/lv_manip.c	2011/10/28 20:29:32	1.310
+++ LVM2/lib/metadata/lv_manip.c	2011/10/28 20:31:01	1.311
@@ -2557,19 +2557,23 @@
 	if (segtype_is_virtual(segtype))
 		return lv_add_virtual_segment(lv, 0u, extents, segtype, thin_pool_name);
 
-	if (segtype_is_thin_pool(segtype))
+	if (!lv->le_count && segtype_is_thin_pool(segtype))
+		/* Thin pool allocation treats its metadata device like a mirror log. */
 		log_count = 1;
 	else if (segtype_is_raid(segtype) && !lv->le_count)
 		log_count = mirrors * stripes;
 
-	/* Thin pool allocation treats its metadata device like a mirror log. */
 	if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors,
 				    log_count, region_size, extents,
 				    allocatable_pvs, alloc, NULL)))
 		return_0;
 
 	if (segtype_is_thin_pool(segtype)) {
-		if (!(r = extend_pool(lv, segtype, ah)))
+		if (!lv->le_count) {
+			if (!(r = extend_pool(lv, segtype, ah)))
+				stack;
+		} else if (!(r = _lv_extend_layered_lv(ah, lv, extents, 0,
+						       stripes, stripe_size)))
 			stack;
 	} else if (!segtype_is_mirrored(segtype) && !segtype_is_raid(segtype)) {
 		if (!(r = lv_add_segment(ah, 0, ah->area_count, lv, segtype,
--- LVM2/tools/lvresize.c	2011/10/06 15:32:27	1.139
+++ LVM2/tools/lvresize.c	2011/10/28 20:31:01	1.140
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -669,6 +669,25 @@
 		}
 	}
 
+	if (lv_is_thin_pool(lv)) {
+		if (lp->resize == LV_REDUCE) {
+			log_error("Thin pool volumes cannot be reduced in size yet.");
+			return ECMD_FAILED;
+		}
+
+		if (lp->resizefs) {
+			log_warn("Thin pool volumes do not have filesystem.");
+			lp->resizefs = 0;
+		}
+
+		if (!lp->stripes) {
+			/* Try to use the same strip settings for underlying pool data LV */
+			lp->stripes = last_seg(seg_lv(first_seg(lv), 0))->area_count;
+			if (!lp->stripe_size)
+				lp->stripe_size = last_seg(seg_lv(first_seg(lv), 0))->stripe_size;
+		}
+	}
+
 	if ((lp->resize == LV_REDUCE) && lp->argc)
 		log_warn("Ignoring PVs on command line when reducing");
 
@@ -730,6 +749,10 @@
 	/* If snapshot, must suspend all associated devices */
 	if (lv_is_cow(lv))
 		lock_lv = origin_from_cow(lv);
+	else if (lv_is_used_thin_pool(lv))
+		// FIXME: what to pick here - maybe an active thin?
+		// but it still seems to be racy in cluster
+		lock_lv = lv;
 	else
 		lock_lv = lv;
 


                 reply	other threads:[~2011-10-28 20:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20111028203102.9052.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).