[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/group/gfs_controld cpg.c group.c plock ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	teigland sourceware org	2007-07-19 20:23:16

Modified files:
	group/gfs_controld: cpg.c group.c plock.c recover.c 

Log message:
	clean up warnings, report more precise plock times (sync with HEAD)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/cpg.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.9.2.2&r2=1.9.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/group.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/plock.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.25.2.6&r2=1.25.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/recover.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.23.2.8&r2=1.23.2.9

--- cluster/group/gfs_controld/cpg.c	2006/11/30 19:49:36	1.9.2.2
+++ cluster/group/gfs_controld/cpg.c	2007/07/19 20:23:16	1.9.2.3
@@ -222,7 +222,7 @@
 	}
 	if (error != CPG_OK) {
 		log_error("cpg_mcast_joined error %d handle %llx %s",
-			  error, h, msg_name(type));
+			  error, (unsigned long long)h, msg_name(type));
 		return -1;
 	}
 
--- cluster/group/gfs_controld/group.c	2006/10/13 20:00:02	1.4
+++ cluster/group/gfs_controld/group.c	2007/07/19 20:23:16	1.4.2.1
@@ -170,7 +170,7 @@
 	gh = group_init(NULL, LOCK_DLM_GROUP_NAME, LOCK_DLM_GROUP_LEVEL,
 			&callbacks, 10);
 	if (!gh) {
-		log_error("group_init error %d %d", (int) gh, errno);
+		log_error("group_init error %p %d", gh, errno);
 		return -ENOTCONN;
 	}
 
--- cluster/group/gfs_controld/plock.c	2007/06/08 21:31:56	1.25.2.6
+++ cluster/group/gfs_controld/plock.c	2007/07/19 20:23:16	1.25.2.7
@@ -307,10 +307,15 @@
 		return rv;
 
 	log_debug("plocks %d", control_fd);
+	log_debug("plock cpg message size: %u bytes",
+		  (unsigned int) (sizeof(struct gdlm_header) +
+		                  sizeof(struct gdlm_plock_info)));
 
 	return control_fd;
 }
 
+/* FIXME: unify these two */
+
 static unsigned long time_diff_ms(struct timeval *begin, struct timeval *end)
 {
 	struct timeval result;
@@ -318,6 +323,16 @@
 	return (result.tv_sec * 1000) + (result.tv_usec / 1000);
 }
 
+static uint64_t dt_usec(struct timeval *start, struct timeval *stop)
+{
+	uint64_t dt;
+
+	dt = stop->tv_sec - start->tv_sec;
+	dt *= 1000000;
+	dt += stop->tv_usec - start->tv_usec;
+	return dt;
+}
+
 int process_plocks(void)
 {
 	struct mountgroup *mg;
@@ -325,6 +340,7 @@
 	struct gdlm_header *hd;
 	struct timeval now;
 	char *buf;
+	uint64_t usec;
 	int len, rv;
 
 	/* Don't send more messages while the cpg message queue is backed up */
@@ -370,21 +386,20 @@
 	}
 
 	log_plock(mg, "read plock %llx %s %s %llx-%llx %d/%u/%llx w %d",
-		  info.number,
+		  (unsigned long long)info.number,
 		  op_str(info.optype),
 		  ex_str(info.optype, info.ex),
-		  info.start, info.end,
-		  info.nodeid, info.pid, info.owner,
+		  (unsigned long long)info.start, (unsigned long long)info.end,
+		  info.nodeid, info.pid, (unsigned long long)info.owner,
 		  info.wait);
 
 	/* report plock rate and any delays since the last report */
 	plock_read_count++;
 	if (!(plock_read_count % 1000)) {
 		gettimeofday(&now, NULL);
-		log_group(mg, "plock_read_count %u time %us delays %u",
-			  plock_read_count,
-			  (unsigned) (now.tv_sec - plock_read_time.tv_sec),
-			  plock_rate_delays);
+		usec = dt_usec(&plock_read_time, &now) ;
+		log_group(mg, "plock_read_count %u time %.3f s delays %u",
+			  plock_read_count, usec * 1.e-6, plock_rate_delays);
 		plock_read_time = now;
 		plock_rate_delays = 0;
 	}
@@ -937,6 +952,7 @@
 	struct gdlm_plock_info info;
 	struct gdlm_header *hd = (struct gdlm_header *) buf;
 	struct timeval now;
+	uint64_t usec;
 	int rv = 0;
 
 	memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info));
@@ -944,18 +960,19 @@
 	info_bswap_in(&info);
 
 	log_plock(mg, "receive plock %llx %s %s %llx-%llx %d/%u/%llx w %d",
-		  info.number,
+		  (unsigned long long)info.number,
 		  op_str(info.optype),
 		  ex_str(info.optype, info.ex),
-		  info.start, info.end,
-		  info.nodeid, info.pid, info.owner,
+		  (unsigned long long)info.start, (unsigned long long)info.end,
+		  info.nodeid, info.pid, (unsigned long long)info.owner,
 		  info.wait);
 
 	plock_recv_count++;
 	if (!(plock_recv_count % 1000)) {
 		gettimeofday(&now, NULL);
-		log_group(mg, "plock_recv_count %u time %us", plock_recv_count,
-			  (unsigned) (now.tv_sec - plock_recv_time.tv_sec));
+		usec = dt_usec(&plock_recv_time, &now);
+		log_group(mg, "plock_recv_count %u time %.3f s",
+			  plock_recv_count, usec * 1.e-6);
 		plock_recv_time = now;
 	}
 
@@ -1076,6 +1093,7 @@
 	struct resource *r;
 	int count = section_len / sizeof(struct pack_plock);
 	int i;
+	unsigned long long num;
 
 	r = malloc(sizeof(struct resource));
 	if (!r)
@@ -1083,7 +1101,8 @@
 	memset(r, 0, sizeof(struct resource));
 	INIT_LIST_HEAD(&r->locks);
 	INIT_LIST_HEAD(&r->waiters);
-	sscanf(numbuf, "r%llu", &r->number);
+	sscanf(numbuf, "r%llu", &num);
+	r->number = num;
 
 	pp = (struct pack_plock *) &section_buf;
 
@@ -1122,7 +1141,7 @@
 	int ret = 0;
 
 	h = (SaCkptCheckpointHandleT) mg->cp_handle;
-	log_group(mg, "unlink ckpt %llx", h);
+	log_group(mg, "unlink ckpt %llx", (unsigned long long)h);
 
  unlink_retry:
 	rv = saCkptCheckpointUnlink(ckpt_handle, name);
@@ -1151,9 +1170,9 @@
 
 	log_group(mg, "unlink ckpt status: size %llu, max sections %u, "
 		      "max section size %llu, section count %u, mem %u",
-		 s.checkpointCreationAttributes.checkpointSize,
+		 (unsigned long long)s.checkpointCreationAttributes.checkpointSize,
 		 s.checkpointCreationAttributes.maxSections,
-		 s.checkpointCreationAttributes.maxSectionSize,
+		 (unsigned long long)s.checkpointCreationAttributes.maxSectionSize,
 		 s.numberOfSections, s.memoryUsed);
 
  out_close:
@@ -1167,7 +1186,8 @@
 		goto out_close;
 	}
 	if (rv != SA_AIS_OK) {
-		log_error("unlink ckpt %llx close err %d %s", h, rv, mg->name);
+		log_error("unlink ckpt %llx close err %d %s",
+			  (unsigned long long)h, rv, mg->name);
 		/* should we return an error here and possibly cause
 		   store_plocks() to fail on this? */
 		/* ret = -1; */
@@ -1182,7 +1202,8 @@
 	SaNameT name;
 	int len;
 
-	len = snprintf(name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s", mg->name);
+	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s",
+		       mg->name);
 	name.length = len;
 	return _unlink_checkpoint(mg, &name);
 }
@@ -1224,7 +1245,8 @@
 	}
 	mg->last_checkpoint_time = time(NULL);
 
-	len = snprintf(name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s", mg->name);
+	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s",
+		       mg->name);
 	name.length = len;
 
 	/* unlink an old checkpoint before we create a new one */
@@ -1257,8 +1279,8 @@
 			max_section_size = section_size;
 	}
 
-	log_group(mg, "store_plocks: r_count %d, lock_count %d, pp %d bytes",
-		  r_count, lock_count, sizeof(struct pack_plock));
+	log_group(mg, "store_plocks: r_count %d, lock_count %d, pp %u bytes",
+		  r_count, lock_count, (unsigned int)sizeof(struct pack_plock));
 
 	log_group(mg, "store_plocks: total %d bytes, max_section %d bytes",
 		  total_size, max_section_size);
@@ -1292,14 +1314,15 @@
 		return;
 	}
 
-	log_group(mg, "store_plocks: open ckpt handle %llx", h);
+	log_group(mg, "store_plocks: open ckpt handle %llx",
+		  (unsigned long long)h);
 	mg->cp_handle = (uint64_t) h;
 
 	list_for_each_entry(r, &mg->resources, list) {
 		memset(&buf, 0, 32);
-		len = snprintf(buf, 32, "r%llu", r->number);
+		len = snprintf(buf, 32, "r%llu", (unsigned long long)r->number);
 
-		section_id.id = buf;
+		section_id.id = (void *)buf;
 		section_id.idLen = len + 1;
 		section_attr.sectionId = &section_id;
 		section_attr.expirationTime = SA_TIME_END;
@@ -1362,7 +1385,8 @@
 
 	log_group(mg, "retrieve_plocks");
 
-	len = snprintf(name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s", mg->name);
+	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s",
+		       mg->name);
 	name.length = len;
 
  open_retry:
@@ -1419,7 +1443,8 @@
 		memset(&buf, 0, 32);
 		snprintf(buf, 32, "%s", desc.sectionId.id);
 		log_group(mg, "retrieve_plocks: section size %llu id %u \"%s\"",
-			  iov.dataSize, iov.sectionId.idLen, buf);
+			  (unsigned long long)iov.dataSize, iov.sectionId.idLen,
+			  buf);
 
 	 read_retry:
 		rv = saCkptCheckpointRead(h, &iov, 1, NULL);
@@ -1435,7 +1460,7 @@
 		}
 
 		log_group(mg, "retrieve_plocks: ckpt read %llu bytes",
-			  iov.readSize);
+			  (unsigned long long)iov.readSize);
 		section_len = iov.readSize;
 
 		if (!section_len)
@@ -1447,7 +1472,8 @@
 			continue;
 		}
 
-		unpack_section_buf(mg, desc.sectionId.id, desc.sectionId.idLen);
+		unpack_section_buf(mg, (char *)desc.sectionId.id,
+				   desc.sectionId.idLen);
 	}
 
  out_it:
@@ -1527,10 +1553,12 @@
 		list_for_each_entry(po, &r->locks, list) {
 			snprintf(line, MAXLINE,
 			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx\n",
-			      r->number,
+			      (unsigned long long)r->number,
 			      po->ex ? "WR" : "RD",
-			      po->start, po->end,
-			      po->nodeid, po->pid, po->owner);
+			      (unsigned long long)po->start,
+			      (unsigned long long)po->end,
+			      po->nodeid, po->pid,
+			      (unsigned long long)po->owner);
 
 			rv = do_write(fd, line, strlen(line));
 		}
@@ -1538,10 +1566,12 @@
 		list_for_each_entry(w, &r->waiters, list) {
 			snprintf(line, MAXLINE,
 			      "%llu WAITING %s %llu-%llu nodeid %d pid %u owner %llx\n",
-			      r->number,
+			      (unsigned long long)r->number,
 			      w->info.ex ? "WR" : "RD",
-			      w->info.start, w->info.end,
-			      w->info.nodeid, w->info.pid, w->info.owner);
+			      (unsigned long long)w->info.start,
+			      (unsigned long long)w->info.end,
+			      w->info.nodeid, w->info.pid,
+			      (unsigned long long)w->info.owner);
 
 			rv = do_write(fd, line, strlen(line));
 		}
--- cluster/group/gfs_controld/recover.c	2007/06/08 18:07:45	1.23.2.8
+++ cluster/group/gfs_controld/recover.c	2007/07/19 20:23:16	1.23.2.9
@@ -1667,7 +1667,7 @@
 
 	if (strlen(options) > MAX_OPTIONS_LEN-1) {
 		rv = -EMLINK;
-		log_error("mount: options too long %d", strlen(options));
+		log_error("mount: options too long %zu", strlen(options));
 		goto out;
 	}
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]