public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/daemons/dmeventd/plugins/thin dmeventd_thin.c
@ 2011-12-22 15:57 zkabelac
  0 siblings, 0 replies; 3+ messages in thread
From: zkabelac @ 2011-12-22 15:57 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-12-22 15:57:29

Modified files:
	daemons/dmeventd/plugins/thin: dmeventd_thin.c 

Log message:
	Thin use helper function
	
	Fix some minor outstading issue from thin plugin introduction -
	Call dmeventd_lvm2_exit() in failpath for registration.
	Add some missing '\n' in syslog messages.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/thin/dmeventd_thin.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2

--- LVM2/daemons/dmeventd/plugins/thin/dmeventd_thin.c	2011/12/21 13:08:13	1.1
+++ LVM2/daemons/dmeventd/plugins/thin/dmeventd_thin.c	2011/12/22 15:57:29	1.2
@@ -42,14 +42,13 @@
 	int data_percent_check;
 	uint64_t known_meta_size;
 	uint64_t known_data_size;
-	char *vg, *lv, *layer;
 	char cmd_str[1024];
 };
 
 static int _extend(struct dso_state *state)
 {
 #if THIN_DEBUG
-	syslog(LOG_INFO, "dmeventd executes: %s.", state->cmd_str);
+	syslog(LOG_INFO, "dmeventd executes: %s.\n", state->cmd_str);
 #endif
 	return (dmeventd_lvm2_run(state->cmd_str) == ECMD_PROCESSED);
 }
@@ -159,7 +158,7 @@
 	dm_get_next_target(dmt, next, &start, &length, &target_type, &params);
 
 	if (!target_type || (strcmp(target_type, "thin-pool") != 0)) {
-		syslog(LOG_ERR, "Invalid targe type.\n");
+		syslog(LOG_ERR, "Invalid target type.\n");
 		goto out;
 	}
 
@@ -244,18 +243,19 @@
 	struct dm_pool *statemem = NULL;
 	struct dso_state *state;
 
-	if (!dmeventd_lvm2_init() ||
-	    !(statemem = dm_pool_create("thin_pool_state", 2048)) ||
+	if (!dmeventd_lvm2_init())
+		goto bad;
+
+	if (!(statemem = dm_pool_create("thin_pool_state", 2048)) ||
 	    !(state = dm_pool_zalloc(statemem, sizeof(*state))) ||
-	    !dm_split_lvm_name(statemem, device, &state->vg, &state->lv,
-			       &state->layer) ||
-	    (dm_snprintf(state->cmd_str, sizeof(state->cmd_str),
-			 "lvextend --use-policies %s/%s", state->vg, state->lv) < 0)) {
-		syslog(LOG_ERR, "Failed to monitor thin %s.\n", device);
+	    !dmeventd_lvm2_command(statemem, state->cmd_str,
+				   sizeof(state->cmd_str),
+				   "lvextend --use-policies",
+				   device)) {
 		if (statemem)
 			dm_pool_destroy(statemem);
-
-		return 0;
+		dmeventd_lvm2_exit();
+		goto bad;
 	}
 
 	state->mem = statemem;
@@ -266,6 +266,10 @@
 	syslog(LOG_INFO, "Monitoring thin %s.\n", device);
 
 	return 1;
+bad:
+	syslog(LOG_ERR, "Failed to monitor thin %s.\n", device);
+
+	return 0;
 }
 
 int unregister_device(const char *device,
@@ -276,10 +280,9 @@
 {
 	struct dso_state *state = *private;
 
+	syslog(LOG_INFO, "No longer monitoring thin %s.\n", device);
 	dm_pool_destroy(state->mem);
 	dmeventd_lvm2_exit();
 
-	syslog(LOG_INFO, "No longer monitoring thin %s.\n", device);
-
 	return 1;
 }


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

* LVM2/daemons/dmeventd/plugins/thin dmeventd_thin.c
@ 2012-03-23  9:40 zkabelac
  0 siblings, 0 replies; 3+ messages in thread
From: zkabelac @ 2012-03-23  9:40 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-03-23 09:40:00

Modified files:
	daemons/dmeventd/plugins/thin: dmeventd_thin.c 

Log message:
	Update debug message
	
	(compiled only with special debug define)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/thin/dmeventd_thin.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5

--- LVM2/daemons/dmeventd/plugins/thin/dmeventd_thin.c	2012/01/20 10:59:26	1.4
+++ LVM2/daemons/dmeventd/plugins/thin/dmeventd_thin.c	2012/03/23 09:39:59	1.5
@@ -178,7 +178,7 @@
 #if THIN_DEBUG
 	syslog(LOG_INFO, "%p: Got status %" PRIu64 " / %" PRIu64
 	       " %" PRIu64  " / %" PRIu64 ".\n", state,
-	       tps->used_meta_blocks, tps->total_meta_blocks,
+	       tps->used_metadata_blocks, tps->total_metadata_blocks,
 	       tps->used_data_blocks, tps->total_data_blocks);
 #endif
 


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

* LVM2/daemons/dmeventd/plugins/thin dmeventd_thin.c
@ 2012-01-20 10:59 zkabelac
  0 siblings, 0 replies; 3+ messages in thread
From: zkabelac @ 2012-01-20 10:59 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-01-20 10:59:26

Modified files:
	daemons/dmeventd/plugins/thin: dmeventd_thin.c 

Log message:
	Thin forgotten initialisation of pointer to NULL
	
	Since the code may go in error path, set to defined NULL.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/plugins/thin/dmeventd_thin.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4

--- LVM2/daemons/dmeventd/plugins/thin/dmeventd_thin.c	2012/01/19 15:21:23	1.3
+++ LVM2/daemons/dmeventd/plugins/thin/dmeventd_thin.c	2012/01/20 10:59:26	1.4
@@ -142,7 +142,7 @@
 	const char *device = dm_task_get_name(dmt);
 	int percent;
 	struct dso_state *state = *private;
-	struct dm_status_thin_pool *tps;
+	struct dm_status_thin_pool *tps = NULL;
 	void *next = NULL;
 	uint64_t start, length;
 	char *target_type = NULL;


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

end of thread, other threads:[~2012-03-23  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-22 15:57 LVM2/daemons/dmeventd/plugins/thin dmeventd_thin.c zkabelac
2012-01-20 10:59 zkabelac
2012-03-23  9:40 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).