Skip to contentSkip to conversation

LVM2/daemons/clogd clogd.c cluster.c cluster.h ...

PATCH [email protected] 1 participant 1 message Jul 21, 2009

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow at sourceware.org 2009-07-21 15:34:53

Modified files:
daemons/clogd : clogd.c cluster.c cluster.h common.h
functions.c functions.h local.c local.h logging.c logging.h

Log message:
After rebasing the cluster logging code, adjustments need to be made to compensate for the changes in the kernel-side component that recently went upstream. (Things like: renamed structures, removal of structure fields, and changes to arguments passed between userspace and kernel.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/clogd.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/cluster.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/cluster.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/common.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/functions.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/functions.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/local.c.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/local.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/logging.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clogd/logging.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2

daemons/clogd/clogd.c +4 -4
@@ -13,7 +13,7 @@
 #include <linux/types.h>
 #include <sys/socket.h>
 #include <linux/netlink.h>
-#include <linux/dm-clog-tfr.h>
+#include <linux/dm-log-userspace.h>
 #include <linux/dm-ioctl.h>
 
 #include "functions.h"
@@ -190,13 +190,13 @@
 			LOG_ERROR("Failed to create lockfile");
 			LOG_ERROR("Process already running?");
 			break;
-		case EXIT_KERNEL_TFR_SOCKET:
+		case EXIT_KERNEL_SOCKET:
 			LOG_ERROR("Unable to create netlink socket");
 			break;
-		case EXIT_KERNEL_TFR_BIND:
+		case EXIT_KERNEL_BIND:
 			LOG_ERROR("Unable to bind to netlink socket");
 			break;
-		case EXIT_KERNEL_TFR_SETSOCKOPT:
+		case EXIT_KERNEL_SETSOCKOPT:
 			LOG_ERROR("Unable to setsockopt on netlink socket");
 			break;
 		case EXIT_CLUSTER_CKPT_INIT:
daemons/clogd/cluster.c +252 -261

960 lines not on this page · raw message

daemons/clogd/cluster.h +34 -1
@@ -1,6 +1,39 @@
 #ifndef __CLUSTER_LOG_CLUSTER_DOT_H__
 #define __CLUSTER_LOG_CLUSTER_DOT_H__
 
+#include "list.h"
+#include <linux/dm-log-userspace.h>
+
+/*
+ * There is other information in addition to what can
+ * be found in the dm_ulog_request structure that we
+ * need for processing.  'clog_request' is the wrapping
+ * structure we use to make the additional fields
+ * available.
+ */
+struct clog_request {
+	struct list_head list;
+
+	/*
+	 * 'originator' is the machine from which the requests
+	 * was made.
+	 */
+	uint32_t originator;
+
+	/*
+	 * 'pit_server' is the "point-in-time" server for the
+	 * request.  (I.e.  The machine that was the server at
+	 * the time the request was issued - only important during
+	 * startup.
+	 */
+	uint32_t pit_server;
+
+	/*
+	 * The request from the kernel that is being processed
+	 */
+	struct dm_ulog_request u_rq;
+};
+
 int init_cluster(void);
 void cleanup_cluster(void);
 void cluster_debug(void);
@@ -8,6 +41,6 @@
 int create_cluster_cpg(char *str);
 int destroy_cluster_cpg(char *str);
 
-int cluster_send(struct clog_tfr *tfr);
+int cluster_send(struct clog_request *rq);
 
 #endif /* __CLUSTER_LOG_CLUSTER_DOT_H__ */
daemons/clogd/common.h +5 -23
@@ -8,33 +8,15 @@
 
 #define EXIT_LOCKFILE              2
 
-#define EXIT_KERNEL_TFR_SOCKET     3 /* Failed netlink socket create */
-#define EXIT_KERNEL_TFR_BIND       4
-#define EXIT_KERNEL_TFR_SETSOCKOPT 5
+#define EXIT_KERNEL_SOCKET         3 /* Failed netlink socket create */
+#define EXIT_KERNEL_BIND           4
+#define EXIT_KERNEL_SETSOCKOPT     5
 
 #define EXIT_CLUSTER_CKPT_INIT     6 /* Failed to init checkpoint */
 
 #define EXIT_QUEUE_NOMEM           7
 
-/* Located in dm-clog-tfr.h
-#define RQ_TYPE(x) \
-	((x) == DM_CLOG_CTR) ? "DM_CLOG_CTR" : \
-	((x) == DM_CLOG_DTR) ? "DM_CLOG_DTR" : \
-	((x) == DM_CLOG_PRESUSPEND) ? "DM_CLOG_PRESUSPEND" : \
-	((x) == DM_CLOG_POSTSUSPEND) ? "DM_CLOG_POSTSUSPEND" : \
-	((x) == DM_CLOG_RESUME) ? "DM_CLOG_RESUME" : \
-	((x) == DM_CLOG_GET_REGION_SIZE) ? "DM_CLOG_GET_REGION_SIZE" : \
-	((x) == DM_CLOG_IS_CLEAN) ? "DM_CLOG_IS_CLEAN" : \
-	((x) == DM_CLOG_IN_SYNC) ? "DM_CLOG_IN_SYNC" : \
-	((x) == DM_CLOG_FLUSH) ? "DM_CLOG_FLUSH" : \
-	((x) == DM_CLOG_MARK_REGION) ? "DM_CLOG_MARK_REGION" : \
-	((x) == DM_CLOG_CLEAR_REGION) ? "DM_CLOG_CLEAR_REGION" : \
-	((x) == DM_CLOG_GET_RESYNC_WORK) ? "DM_CLOG_GET_RESYNC_WORK" : \
-	((x) == DM_CLOG_SET_REGION_SYNC) ? "DM_CLOG_SET_REGION_SYNC" : \
-	((x) == DM_CLOG_GET_SYNC_COUNT) ? "DM_CLOG_GET_SYNC_COUNT" : \
-	((x) == DM_CLOG_STATUS_INFO) ? "DM_CLOG_STATUS_INFO" : \
-	((x) == DM_CLOG_STATUS_TABLE) ? "DM_CLOG_STATUS_TABLE" : \
-	NULL
-*/
+
+#define DM_ULOG_REQUEST_SIZE 1024
 
 #endif /* __CLUSTER_LOG_COMMON_DOT_H__ */
daemons/clogd/functions.c +251 -240

1,094 lines not on this page · raw message

daemons/clogd/functions.h +7 -5
@@ -1,19 +1,21 @@
 #ifndef __CLOG_FUNCTIONS_DOT_H__
 #define __CLOG_FUNCTIONS_DOT_H__
 
-#include <linux/dm-clog-tfr.h>
+#include <linux/dm-log-userspace.h>
+#include "cluster.h"
 
 #define LOG_RESUMED   1
 #define LOG_SUSPENDED 2
 
-int local_resume(struct clog_tfr *tfr);
+int local_resume(struct dm_ulog_request *rq);
 int cluster_postsuspend(char *);
 
-int do_request(struct clog_tfr *tfr, int server);
-int push_state(const char *uuid, const char *which, char **buf, uint32_t debug_who);
+int do_request(struct clog_request *rq, int server);
+int push_state(const char *uuid, const char *which,
+	       char **buf, uint32_t debug_who);
 int pull_state(const char *uuid, const char *which, char *buf, int size);
 
-int log_get_state(struct clog_tfr *tfr);
+int log_get_state(struct dm_ulog_request *rq);
 int log_status(void);
 void log_debug(void);
 
daemons/clogd/local.c +99 -76

371 lines not on this page · raw message

daemons/clogd/local.h +1 -1
@@ -4,6 +4,6 @@
 int init_local(void);
 void cleanup_local(void);
 
-int kernel_send(struct clog_tfr *tfr);
+int kernel_send(struct dm_ulog_request *rq);
 
 #endif /* __CLUSTER_LOG_LOCAL_DOT_H__ */
daemons/clogd/logging.c +22 -0
@@ -1,5 +1,27 @@
+#include <stdio.h>
 #include <syslog.h>
 
+char *__rq_types_off_by_one[] = {
+	"DM_ULOG_CTR",
+	"DM_ULOG_DTR",
+	"DM_ULOG_PRESUSPEND",
+	"DM_ULOG_POSTSUSPEND",
+	"DM_ULOG_RESUME",
+	"DM_ULOG_GET_REGION_SIZE",
+	"DM_ULOG_IS_CLEAN",
+	"DM_ULOG_IN_SYNC",
+	"DM_ULOG_FLUSH",
+	"DM_ULOG_MARK_REGION",
+	"DM_ULOG_CLEAR_REGION",
+	"DM_ULOG_GET_RESYNC_WORK",
+	"DM_ULOG_SET_REGION_SYNC",
+	"DM_ULOG_GET_SYNC_COUNT",
+	"DM_ULOG_STATUS_INFO",
+	"DM_ULOG_STATUS_TABLE",
+	"DM_ULOG_IS_REMOTE_RECOVERING",
+	NULL
+};
+
 int log_tabbing = 0;
 int log_is_open = 0;
 
daemons/clogd/logging.h +3 -0
@@ -31,6 +31,9 @@
 /* SHORT_UUID - print last 8 chars of a string */
 #define SHORT_UUID(x) (strlen(x) > 8) ? ((x) + (strlen(x) - 8)) : (x)
 
+extern char *__rq_types_off_by_one[];
+#define RQ_TYPE(x) __rq_types_off_by_one[(x) - 1]
+
 extern int log_tabbing;
 extern int log_is_open;
 extern int log_membership_change;