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 lib/metadata/meta ...
Date: Tue, 05 Aug 2008 12:05:00 -0000	[thread overview]
Message-ID: <20080805120527.12988.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2008-08-05 12:05:26

Modified files:
	lib/metadata   : lv_manip.c metadata-exported.h metadata.c 
	.              : WHATS_NEW 

Log message:
	vgremove tries to remove lv snapshot first.
	Added function lv_remove_with_dependencies().

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.154&r2=1.155
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.184&r2=1.185
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.943&r2=1.944

--- LVM2/lib/metadata/lv_manip.c	2008/04/22 12:54:33	1.154
+++ LVM2/lib/metadata/lv_manip.c	2008/08/05 12:05:25	1.155
@@ -2049,6 +2049,27 @@
 }
 
 /*
+ * remove LVs with its dependencies - LV leaf nodes should be removed first
+ */
+int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *lv,
+				const force_t force)
+{
+	struct list *snh, *snht;
+
+        if (lv_is_origin(lv)) {
+		/* remove snapshot LVs first */
+		list_iterate_safe(snh, snht, &lv->snapshot_segs) {
+			if (!lv_remove_with_dependencies(cmd, list_struct_base(snh, struct lv_segment,
+									       origin_list)->cow,
+							 force))
+				return 0;
+		}
+	}
+
+        return lv_remove_single(cmd, lv, force);
+}
+
+/*
  * insert_layer_for_segments_on_pv() inserts a layer segment for a segment area.
  * However, layer modification could split the underlying layer segment.
  * This function splits the parent area according to keep the 1:1 relationship
--- LVM2/lib/metadata/metadata-exported.h	2008/06/24 20:10:31	1.49
+++ LVM2/lib/metadata/metadata-exported.h	2008/08/05 12:05:25	1.50
@@ -416,6 +416,9 @@
 int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
 		     force_t force);
 
+int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *lv,
+				force_t force);
+
 int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
 	      const char *new_name);
 
--- LVM2/lib/metadata/metadata.c	2008/06/27 15:18:31	1.184
+++ LVM2/lib/metadata/metadata.c	2008/08/05 12:05:25	1.185
@@ -298,8 +298,8 @@
 {
 	struct lv_list *lvl;
 
-	list_iterate_items(lvl, &vg->lvs)
-		if (!lv_remove_single(cmd, lvl->lv, force))
+        while ((lvl = list_first(&vg->lvs)))
+		if (!lv_remove_with_dependencies(cmd, lvl->lv, force))
 			return 0;
 
 	return 1;
--- LVM2/WHATS_NEW	2008/08/01 19:51:27	1.943
+++ LVM2/WHATS_NEW	2008/08/05 12:05:26	1.944
@@ -1,5 +1,7 @@
 Version 2.02.40 - 
 ================================
+  vgremove tries to remove lv snapshot first.
+  Added function lv_remove_with_dependencies().
   Improve file descriptor leak detection to display likely culprit and filename.
   Change clustered mirror kernel module name from cmirror to dm-log-clustered.
   Avoid looping forever in _pv_analyze_mda_raw used by pvck.


             reply	other threads:[~2008-08-05 12:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-05 12:05 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-04-06 21:32 jbrassow
2009-07-26  2:33 wysochanski
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
2005-04-07 12:29 agk

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=20080805120527.12988.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).