public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/activate dev_manager.c dev_manager.h
@ 2011-12-21 13:09 zkabelac
  0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2011-12-21 13:09 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-12-21 13:09:34

Modified files:
	lib/activate   : dev_manager.c dev_manager.h 

Log message:
	Thin add dev_manager_thin_pool_percent
	
	dev manager function to read percent info from thin pool.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.255&r2=1.256
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.h.diff?cvsroot=lvm2&r1=1.40&r2=1.41

--- LVM2/lib/activate/dev_manager.c	2011/12/21 12:59:22	1.255
+++ LVM2/lib/activate/dev_manager.c	2011/12/21 13:09:33	1.256
@@ -872,6 +872,30 @@
 
 #endif
 
+int dev_manager_thin_pool_percent(struct dev_manager *dm,
+				  const struct logical_volume *lv,
+				  percent_t *percent)
+{
+	char *name;
+	const char *dlid;
+
+	/*
+	 * Build a name for the top layer.
+	 */
+	if (!(name = dm_build_dm_name(dm->mem, lv->vg->name, lv->name, thin_layer)))
+		return_0;
+
+	if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, thin_layer)))
+		return_0;
+
+	log_debug("Getting device status percentage for %s", name);
+	if (!(_percent(dm, name, dlid, "thin-pool", 0, NULL, percent,
+		       NULL, 1)))
+		return_0;
+
+	return 1;
+}
+
 /*************************/
 /*  NEW CODE STARTS HERE */
 /*************************/
--- LVM2/lib/activate/dev_manager.h	2011/10/17 14:18:07	1.40
+++ LVM2/lib/activate/dev_manager.h	2011/12/21 13:09:34	1.41
@@ -52,6 +52,9 @@
 int dev_manager_mirror_percent(struct dev_manager *dm,
 			       const struct logical_volume *lv, int wait,
 			       percent_t *percent, uint32_t *event_nr);
+int dev_manager_thin_pool_percent(struct dev_manager *dm,
+				  const struct logical_volume *lv,
+				  percent_t *percent);
 int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv,
 			struct lv_activate_opts *laopts, int lockfs, int flush_required);
 int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv,


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

* LVM2/lib/activate dev_manager.c dev_manager.h
@ 2010-11-30 22:28 zkabelac
  0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2010-11-30 22:28 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2010-11-30 22:28:06

Modified files:
	lib/activate   : dev_manager.c dev_manager.h 

Log message:
	Remove check for lv is NULL
	
	'lv' is deferenced in the begining of the function so any check
	later is not helpful.
	
	Parameters for dev_manager_transien() are marked as nonnull.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.206&r2=1.207
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.h.diff?cvsroot=lvm2&r1=1.35&r2=1.36

--- LVM2/lib/activate/dev_manager.c	2010/11/30 11:53:31	1.206
+++ LVM2/lib/activate/dev_manager.c	2010/11/30 22:28:06	1.207
@@ -601,14 +601,13 @@
 	do {
 		next = dm_get_next_target(dmt, next, &start, &length, &type,
 					  &params);
-		if (lv) {
-			if (!(segh = dm_list_next(&lv->segments, segh))) {
-				log_error("Number of segments in active LV %s "
-					  "does not match metadata", lv->name);
-				goto out;
-			}
-			seg = dm_list_item(segh, struct lv_segment);
+
+		if (!(segh = dm_list_next(&lv->segments, segh))) {
+		    log_error("Number of segments in active LV %s "
+			      "does not match metadata", lv->name);
+		    goto out;
 		}
+		seg = dm_list_item(segh, struct lv_segment);
 
 		if (!type || !params)
 			continue;
@@ -619,7 +618,7 @@
 
 	} while (next);
 
-	if (lv && (segh = dm_list_next(&lv->segments, segh))) {
+	if ((segh = dm_list_next(&lv->segments, segh))) {
 		log_error("Number of segments in active LV %s does not "
 			  "match metadata", lv->name);
 		goto out;
--- LVM2/lib/activate/dev_manager.h	2010/11/30 11:53:31	1.35
+++ LVM2/lib/activate/dev_manager.h	2010/11/30 22:28:06	1.36
@@ -56,7 +56,7 @@
 int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv,
 			unsigned origin_only, int *flush_required);
 int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv);
-int dev_manager_transient(struct dev_manager *dm, struct logical_volume *lv);
+int dev_manager_transient(struct dev_manager *dm, struct logical_volume *lv) __attribute__((nonnull(1, 2)));
 
 int dev_manager_mknodes(const struct logical_volume *lv);
 


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

end of thread, other threads:[~2011-12-21 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 13:09 LVM2/lib/activate dev_manager.c dev_manager.h zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2010-11-30 22:28 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).