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

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

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

Log message:
	Thin add lv_thin_pool_percent

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.225&r2=1.226
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.89&r2=1.90

--- LVM2/lib/activate/activate.c	2011/12/21 13:08:13	1.225
+++ LVM2/lib/activate/activate.c	2011/12/21 13:10:05	1.226
@@ -689,6 +689,30 @@
 	return lv_mirror_percent(lv->vg->cmd, lv, 0, percent, NULL);
 }
 
+/*
+ * Returns 1 if percent set, else 0 on failure.
+ */
+int lv_thin_pool_percent(const struct logical_volume *lv, percent_t *percent)
+{
+	int r;
+	struct dev_manager *dm;
+
+	if (!activation())
+		return 0;
+
+	log_debug("Checking thin pool percent for LV %s/%s", lv->vg->name, lv->name);
+
+	if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
+		return_0;
+
+	if (!(r = dev_manager_thin_pool_percent(dm, lv, percent)))
+		stack;
+
+	dev_manager_destroy(dm);
+
+	return r;
+}
+
 static int _lv_active(struct cmd_context *cmd, struct logical_volume *lv)
 {
 	struct lvinfo info;
--- LVM2/lib/activate/activate.h	2011/11/28 20:37:51	1.89
+++ LVM2/lib/activate/activate.h	2011/12/21 13:10:06	1.90
@@ -100,6 +100,7 @@
 int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
 		      int wait, percent_t *percent, uint32_t *event_nr);
 int lv_raid_percent(const struct logical_volume *lv, percent_t *percent);
+int lv_thin_pool_percent(const struct logical_volume *lv, percent_t *percent);
 
 /*
  * Return number of LVs in the VG that are active.


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

* LVM2/lib/activate activate.c activate.h
@ 2011-11-11 15:14 mbroz
  0 siblings, 0 replies; 6+ messages in thread
From: mbroz @ 2011-11-11 15:14 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2011-11-11 15:14:05

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

Log message:
	Fix function name in previous patch.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.221&r2=1.222
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.86&r2=1.87

--- LVM2/lib/activate/activate.c	2011/11/11 15:11:10	1.221
+++ LVM2/lib/activate/activate.c	2011/11/11 15:14:05	1.222
@@ -147,7 +147,7 @@
 {
 	return 0;
 }
-int dm_prefix_check(const char *sysfs_dir, int major, int minor, const char *prefix)
+int lvm_dm_prefix_check(const char *sysfs_dir, int major, int minor, const char *prefix)
 {
 	return 0;
 }
@@ -443,14 +443,14 @@
 	return r;
 }
 
-int dm_prefix_check(const char *sysfs_dir, int major, int minor, const char *prefix)
+int lvm_dm_prefix_check(const char *sysfs_dir, int major, int minor, const char *prefix)
 {
 	struct dm_task *dmt;
 	const char *uuid;
 	int r;
 
 	if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
-		return 0;
+		return_0;
 
 	if (!dm_task_set_minor(dmt, minor) ||
 	    !dm_task_set_major(dmt, major) ||
@@ -463,7 +463,7 @@
 	r = strncasecmp(uuid, prefix, strlen(prefix));
 	dm_task_destroy(dmt);
 
-	return (r == 0) ? 1 : 0;
+	return r ? 0 : 1;
 }
 
 int module_present(struct cmd_context *cmd, const char *target_name)
--- LVM2/lib/activate/activate.h	2011/11/11 15:11:10	1.86
+++ LVM2/lib/activate/activate.h	2011/11/11 15:14:05	1.87
@@ -53,7 +53,7 @@
 		   int use_modprobe);
 int target_version(const char *target_name, uint32_t *maj,
 		   uint32_t *min, uint32_t *patchlevel);
-int dm_prefix_check(const char *sysfs_dir, int major, int minor, const char *prefix);
+int lvm_dm_prefix_check(const char *sysfs_dir, int major, int minor, const char *prefix);
 int list_segment_modules(struct dm_pool *mem, const struct lv_segment *seg,
 			 struct dm_list *modules);
 int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv,


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

* LVM2/lib/activate activate.c activate.h
@ 2008-04-10 21:34 wysochanski
  0 siblings, 0 replies; 6+ messages in thread
From: wysochanski @ 2008-04-10 21:34 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-04-10 21:34:18

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

Log message:
	Add lv_is_active() to determine whether an lv is active.
	
	Handles non-clustered as well as clustered.  For clustered,
	the best we can do is try exclusive local activation.  If this
	succeeds, we know it is not active elsewhere in the cluster.
	Otherwise, we assume it is active elsewhere.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.134&r2=1.135
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.60&r2=1.61

--- LVM2/lib/activate/activate.c	2008/04/07 10:23:46	1.134
+++ LVM2/lib/activate/activate.c	2008/04/10 21:34:18	1.135
@@ -674,6 +674,38 @@
 }
 
 /*
+ * Determine whether an LV is active locally or in a cluster.
+ * Assumes vg lock held.
+ * Returns:
+ * 0 - not active locally or on any node in cluster
+ * 1 - active either locally or some node in the cluster
+ */
+int lv_is_active(struct logical_volume *lv)
+{
+	if (_lv_active(lv->vg->cmd, lv, 0))
+		return 1;
+
+	if (!vg_is_clustered(lv->vg))
+		return 0;
+
+	/*
+	 * FIXME: Cluster does not report per-node LV activation status.
+	 * Currently the best we can do is try exclusive local activation.
+	 * If that succeeds, we know the LV is not active elsewhere in the
+	 * cluster.
+	 */
+	if (activate_lv_excl(lv->vg->cmd, lv)) {
+		deactivate_lv(lv->vg->cmd, lv);
+		return 0;
+	}
+
+	/*
+	 * Exclusive local activation failed so assume it is active elsewhere.
+	 */
+	return 1;
+}
+
+/*
  * Returns 0 if an attempt to (un)monitor the device failed.
  * Returns 1 otherwise.
  */
--- LVM2/lib/activate/activate.h	2008/04/07 10:23:46	1.60
+++ LVM2/lib/activate/activate.h	2008/04/10 21:34:18	1.61
@@ -91,6 +91,7 @@
 int lvs_in_vg_activated_by_uuid_only(struct volume_group *vg);
 int lvs_in_vg_opened(const struct volume_group *vg);
 
+int lv_is_active(struct logical_volume *lv);
 
 int monitor_dev_for_events(struct cmd_context *cmd,
 			    struct logical_volume *lv, int do_reg);


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

* LVM2/lib/activate activate.c activate.h
@ 2004-03-26 19:52 agk
  0 siblings, 0 replies; 6+ messages in thread
From: agk @ 2004-03-26 19:52 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2004-03-26 19:52:10

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

Log message:
	Add list_versions to library

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.78&r2=1.79
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.37&r2=1.38


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

* LVM2/lib/activate activate.c activate.h
@ 2004-03-26 15:35 agk
  0 siblings, 0 replies; 6+ messages in thread
From: agk @ 2004-03-26 15:35 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2004-03-26 15:35:02

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

Log message:
	lv_info_by_lvid

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.75&r2=1.76
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.36&r2=1.37


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

* LVM2/lib/activate activate.c activate.h
@ 2004-03-08 18:54 agk
  0 siblings, 0 replies; 6+ messages in thread
From: agk @ 2004-03-08 18:54 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2004-03-08 18:54:14

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

Log message:
	additional activation functions

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.h.diff?cvsroot=lvm2&r1=1.35&r2=1.36


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-21 13:10 LVM2/lib/activate activate.c activate.h zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2011-11-11 15:14 mbroz
2008-04-10 21:34 wysochanski
2004-03-26 19:52 agk
2004-03-26 15:35 agk
2004-03-08 18:54 agk

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