public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/metadata thin_manip.c
@ 2012-01-25  9:17 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2012-01-25  9:17 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-01-25 09:17:15

Modified files:
	lib/metadata   : thin_manip.c 

Log message:
	Thin skip activation when there are no thin message
	
	If the list with thin messages is empty, do not touch thin pool device.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32

--- LVM2/lib/metadata/thin_manip.c	2012/01/25 09:13:10	1.31
+++ LVM2/lib/metadata/thin_manip.c	2012/01/25 09:17:15	1.32
@@ -371,6 +371,9 @@
 		return 0;
 	}
 
+	if (dm_list_empty(&(first_seg(lv)->thin_messages)))
+		return 1; /* No messages */
+
 	if (activate) {
 		/* If the pool is not active, do activate deactivate */
 		if (!lv_is_active(lv)) {
@@ -389,14 +392,12 @@
 		}
 	}
 
-	if (!dm_list_empty(&first_seg(lv)->thin_messages)) {
-		dm_list_init(&first_seg(lv)->thin_messages);
+	dm_list_init(&(first_seg(lv)->thin_messages));
 
-		if (!vg_write(lv->vg) || !vg_commit(lv->vg))
-			return_0;
+	if (!vg_write(lv->vg) || !vg_commit(lv->vg))
+		return_0;
 
-		backup(lv->vg);
-	}
+	backup(lv->vg);
 
 	return 1;
 }


^ permalink raw reply	[flat|nested] 9+ messages in thread

* LVM2/lib/metadata thin_manip.c
@ 2012-02-12 21:42 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2012-02-12 21:42 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2012-02-12 21:42:43

Modified files:
	lib/metadata   : thin_manip.c 

Log message:
	use stack consistently if 0 is considered an error

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34

--- LVM2/lib/metadata/thin_manip.c	2012/02/08 13:05:39	1.33
+++ LVM2/lib/metadata/thin_manip.c	2012/02/12 21:42:43	1.34
@@ -225,22 +225,18 @@
 				     DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD);
 
 	/* Data */
-	if (!lv_thin_pool_percent(pool_seg->lv, 0, &percent)) {
-		stack;
-		return 0;
-	}
+	if (!lv_thin_pool_percent(pool_seg->lv, 0, &percent))
+		return_0;
 
 	if (percent >= threshold)
-		return 0;
+		return_0;
 
 	/* Metadata */
-	if (!lv_thin_pool_percent(pool_seg->lv, 1, &percent)) {
-		stack;
-		return 0;
-	}
+	if (!lv_thin_pool_percent(pool_seg->lv, 1, &percent))
+		return_0;
 
 	if (percent >= threshold)
-		return 0;
+		return_0;
 
 	return 1;
 }


^ permalink raw reply	[flat|nested] 9+ messages in thread

* LVM2/lib/metadata thin_manip.c
@ 2011-12-10  0:47 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2011-12-10  0:47 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-12-10 00:47:23

Modified files:
	lib/metadata   : thin_manip.c 

Log message:
	update FIXMEs

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27

--- LVM2/lib/metadata/thin_manip.c	2011/11/10 12:43:05	1.26
+++ LVM2/lib/metadata/thin_manip.c	2011/12/10 00:47:23	1.27
@@ -244,6 +244,7 @@
 	return max_id;
 }
 
+// FIXME Rename this fn: it doesn't extend an already-existing pool AFAICT
 int extend_pool(struct logical_volume *pool_lv, const struct segment_type *segtype,
 		struct alloc_handle *ah, uint32_t stripes, uint32_t stripe_size)
 {
@@ -285,10 +286,8 @@
 		 * FIXME: implement lazy clearing when activation is disabled
 		 */
 
-		// FIXME: activate_lv_local_excl is actually wanted here
+		/* pool_lv is a new LV so the VG lock protects us */
 		if (!activate_lv_local(pool_lv->vg->cmd, pool_lv) ||
-		    // FIXME: maybe -zero n  should  allow to recreate same thin pool
-		    // and different option should be used for zero_new_blocks
 		    /* Clear 4KB of metadata device for new thin-pool. */
 		    !set_lv(pool_lv->vg->cmd, pool_lv, UINT64_C(0), 0)) {
 			log_error("Aborting. Failed to wipe pool metadata %s.",


^ permalink raw reply	[flat|nested] 9+ messages in thread

* LVM2/lib/metadata thin_manip.c
@ 2011-11-07 11:04 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2011-11-07 11:04 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-11-07 11:04:46

Modified files:
	lib/metadata   : thin_manip.c 

Log message:
	Thin add error message for double delete
	
	Add few more internal error messages.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25

--- LVM2/lib/metadata/thin_manip.c	2011/11/07 11:03:47	1.24
+++ LVM2/lib/metadata/thin_manip.c	2011/11/07 11:04:45	1.25
@@ -74,7 +74,16 @@
 					  tmsg->u.lv->name);
 				dm_list_del(&tmsg->list);
 			}
+			break;
+		case DM_THIN_MESSAGE_DELETE:
+			if (tmsg->u.delete_id == seg->device_id) {
+				log_error(INTERNAL_ERROR "Trying to delete %u again.",
+					  tmsg->u.delete_id);
+				return 0;
+			}
+			break;
 		default:
+			log_error(INTERNAL_ERROR "Unsupported message type %u.", tmsg->type);
 			break;
 		}
 	}


^ permalink raw reply	[flat|nested] 9+ messages in thread

* LVM2/lib/metadata thin_manip.c
@ 2011-11-07 10:59 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2011-11-07 10:59 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-11-07 10:59:08

Modified files:
	lib/metadata   : thin_manip.c 

Log message:
	Thin reindent code
	
	Drop indention level
	Add extra internal error.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.22&r2=1.23

--- LVM2/lib/metadata/thin_manip.c	2011/11/03 15:58:20	1.22
+++ LVM2/lib/metadata/thin_manip.c	2011/11/07 10:59:07	1.23
@@ -88,27 +88,29 @@
 	struct lv_thin_message *tmsg;
 
 	dm_list_iterate_items(tmsg, &seg->thin_messages) {
-		if (tmsg->type == type) {
-			switch (tmsg->type) {
-			case DM_THIN_MESSAGE_CREATE_SNAP:
-			case DM_THIN_MESSAGE_CREATE_THIN:
-			case DM_THIN_MESSAGE_TRIM:
-				if (tmsg->u.lv == lv) {
-					log_error("Message referring LV %s already queued for %s.",
-						  tmsg->u.lv->name, seg->lv->name);
-					return 0;
-				}
-				break;
-			case DM_THIN_MESSAGE_DELETE:
-				if (tmsg->u.delete_id == delete_id) {
-					log_error("Delete of device %u already queued for %s.",
-						  tmsg->u.delete_id, seg->lv->name);
-					return 0;
-				}
-				break;
-			default:
-				break;
+		if (tmsg->type != type)
+			continue;
+
+		switch (tmsg->type) {
+		case DM_THIN_MESSAGE_CREATE_SNAP:
+		case DM_THIN_MESSAGE_CREATE_THIN:
+		case DM_THIN_MESSAGE_TRIM:
+			if (tmsg->u.lv == lv) {
+				log_error("Message referring LV %s already queued for %s.",
+					  tmsg->u.lv->name, seg->lv->name);
+				return 0;
+			}
+			break;
+		case DM_THIN_MESSAGE_DELETE:
+			if (tmsg->u.delete_id == delete_id) {
+				log_error("Delete of device %u already queued for %s.",
+					  tmsg->u.delete_id, seg->lv->name);
+				return 0;
 			}
+			break;
+		default:
+			log_error(INTERNAL_ERROR "Unsupported message type %u.", tmsg->type);
+			return 0;
 		}
 	}
 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* LVM2/lib/metadata thin_manip.c
@ 2011-11-03 15:58 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2011-11-03 15:58 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-11-03 15:58:20

Modified files:
	lib/metadata   : thin_manip.c 

Log message:
	Thin keep pool device in the same state
	
	Leave the optimalisation to be done differently and preserve
	availability state of the pool device.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22

--- LVM2/lib/metadata/thin_manip.c	2011/11/03 14:57:04	1.21
+++ LVM2/lib/metadata/thin_manip.c	2011/11/03 15:58:20	1.22
@@ -307,10 +307,11 @@
 
 	if (activate) {
 		/* If the pool was not yet activated, do it */
-		if (!lv_is_active(lv) &&
-		    !activate_lv_excl(lv->vg->cmd, lv)) {
-			log_error("Failed to activate %s.", lv->name);
-			return 0;
+		if (!lv_is_active(lv)) {
+			if (!activate_lv_excl(lv->vg->cmd, lv))
+				return_0;
+			if (!deactivate_lv(lv->vg->cmd, lv))
+				return_0;
 		}
 		/* If already active, do suspend resume
 		 *


^ permalink raw reply	[flat|nested] 9+ messages in thread

* LVM2/lib/metadata thin_manip.c
@ 2011-10-19 16:37 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2011-10-19 16:37 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-19 16:37:30

Modified files:
	lib/metadata   : thin_manip.c 

Log message:
	Drop messages referencing deleted LV
	
	lvremove may remove problematic LV for thin target.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10

--- LVM2/lib/metadata/thin_manip.c	2011/10/19 16:36:40	1.9
+++ LVM2/lib/metadata/thin_manip.c	2011/10/19 16:37:30	1.10
@@ -46,12 +46,32 @@
 
 int detach_pool_lv(struct lv_segment *seg)
 {
+	struct lv_thin_message *tmsg;
+	struct dm_list *l, *lt;
+
 	if (!lv_is_thin_pool(seg->pool_lv)) {
 		log_error(INTERNAL_ERROR "LV %s is not a thin pool",
 			  seg->pool_lv->name);
 		return 0;
 	}
 
+	/* Drop any message referencing removed segment */
+	dm_list_iterate_safe(l, lt, &first_seg(seg->pool_lv)->thin_messages) {
+		tmsg = dm_list_item(l, struct lv_thin_message);
+		switch (tmsg->type) {
+		case DM_THIN_MESSAGE_CREATE_SNAP:
+		case DM_THIN_MESSAGE_CREATE_THIN:
+		case DM_THIN_MESSAGE_TRIM:
+			if (first_seg(tmsg->u.lv) == seg) {
+				log_debug("Discarding message for LV %s.",
+					  tmsg->u.lv->name);
+				dm_list_del(&tmsg->list);
+			}
+		default:
+			break;
+		}
+	}
+
 	if (!attach_pool_message(first_seg(seg->pool_lv),
 				 DM_THIN_MESSAGE_DELETE,
 				 NULL, seg->device_id, 0))


^ permalink raw reply	[flat|nested] 9+ messages in thread

* LVM2/lib/metadata thin_manip.c
@ 2011-10-19 16:32 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2011-10-19 16:32 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-19 16:32:34

Modified files:
	lib/metadata   : thin_manip.c 

Log message:
	Remove test for thin_pool
	
	Since both functions are called during mda read - we don't have full LV info
	at this moment.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.7&r2=1.8

--- LVM2/lib/metadata/thin_manip.c	2011/10/17 14:17:09	1.7
+++ LVM2/lib/metadata/thin_manip.c	2011/10/19 16:32:34	1.8
@@ -38,12 +38,6 @@
 
 int attach_pool_lv(struct lv_segment *seg, struct logical_volume *pool_lv)
 {
-	if (!lv_is_thin_pool(pool_lv)) {
-		log_error(INTERNAL_ERROR "LV %s is not a thin pool",
-			  pool_lv->name);
-		return 0;
-	}
-
 	seg->pool_lv = pool_lv;
 	seg->lv->status |= THIN_VOLUME;
 
@@ -72,12 +66,6 @@
 {
 	struct lv_thin_message *tmsg;
 
-	if (!lv_is_thin_pool(seg->lv)) {
-		log_error(INTERNAL_ERROR "LV %s is not a thin pool.",
-			  seg->lv->name);
-		return 0;
-	}
-
 	if (!(tmsg = dm_pool_alloc(seg->lv->vg->vgmem, sizeof(*tmsg)))) {
 		log_error("Failed to allocate memory for message.");
 		return 0;


^ permalink raw reply	[flat|nested] 9+ messages in thread

* LVM2/lib/metadata thin_manip.c
@ 2011-10-03 19:10 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2011-10-03 19:10 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-03 19:10:52

Modified files:
	lib/metadata   : thin_manip.c 

Log message:
	Missed rename pool->thin_pool
	
	Fix compilation

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.5&r2=1.6

--- LVM2/lib/metadata/thin_manip.c	2011/10/03 18:39:17	1.5
+++ LVM2/lib/metadata/thin_manip.c	2011/10/03 19:10:52	1.6
@@ -97,7 +97,7 @@
 
 	if (!seg_is_thin_pool(thin_pool_seg)) {
 		log_error("Segment in %s is not a thin pool segment.",
-			  pool_seg->lv->name);
+			  thin_pool_seg->lv->name);
 		return 0;
 	}
 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-02-12 21:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25  9:17 LVM2/lib/metadata thin_manip.c zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2012-02-12 21:42 agk
2011-12-10  0:47 agk
2011-11-07 11:04 zkabelac
2011-11-07 10:59 zkabelac
2011-11-03 15:58 zkabelac
2011-10-19 16:37 zkabelac
2011-10-19 16:32 zkabelac
2011-10-03 19:10 zkabelac

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