From mboxrd@z Thu Jan 1 00:00:00 1970 From: teigland@sourceware.org Date: 11 Jul 2007 17:01:24 -0000 Subject: [Cluster-devel] cluster/group/gfs_controld cpg.c group.c plock ... Message-ID: <20070711170124.4171.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: teigland at sourceware.org 2007-07-11 17:01:23 Modified files: group/gfs_controld: cpg.c group.c plock.c recover.c Log message: add a bunch of casts to quiet warnings on x86-64 print a couple decimal places for times in the debug logging Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/cpg.c.diff?cvsroot=cluster&r1=1.11&r2=1.12 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/group.c.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/plock.c.diff?cvsroot=cluster&r1=1.31&r2=1.32 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/recover.c.diff?cvsroot=cluster&r1=1.31&r2=1.32 --- cluster/group/gfs_controld/cpg.c 2006/11/30 19:48:43 1.11 +++ cluster/group/gfs_controld/cpg.c 2007/07/11 17:01:23 1.12 @@ -222,7 +222,7 @@ } if (error != CPG_OK) { log_error("cpg_mcast_joined error %d handle %llx %s", - error, h, msg_name(type)); + error, (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/11 17:01:23 1.5 @@ -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:30:54 1.31 +++ cluster/group/gfs_controld/plock.c 2007/07/11 17:01:23 1.32 @@ -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, + (long long)info.number, op_str(info.optype), ex_str(info.optype, info.ex), - info.start, info.end, - info.nodeid, info.pid, info.owner, + (long long)info.start, (long long)info.end, + info.nodeid, info.pid, (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, + (long long)info.number, op_str(info.optype), ex_str(info.optype, info.ex), - info.start, info.end, - info.nodeid, info.pid, info.owner, + (long long)info.start, (long long)info.end, + info.nodeid, info.pid, (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 *) §ion_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", (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, + (long long)s.checkpointCreationAttributes.checkpointSize, s.checkpointCreationAttributes.maxSections, - s.checkpointCreationAttributes.maxSectionSize, + (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", + (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,14 @@ return; } - log_group(mg, "store_plocks: open ckpt handle %llx", h); + log_group(mg, "store_plocks: open ckpt handle %llx", (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", (long long)r->number); - section_id.id = buf; + section_id.id = (void *)buf; section_id.idLen = len + 1; section_attr.sectionId = §ion_id; section_attr.expirationTime = SA_TIME_END; @@ -1362,7 +1384,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 +1442,7 @@ 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); + (long long)iov.dataSize, iov.sectionId.idLen, buf); read_retry: rv = saCkptCheckpointRead(h, &iov, 1, NULL); @@ -1435,7 +1458,7 @@ } log_group(mg, "retrieve_plocks: ckpt read %llu bytes", - iov.readSize); + (long long)iov.readSize); section_len = iov.readSize; if (!section_len) @@ -1447,7 +1470,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 +1551,10 @@ list_for_each_entry(po, &r->locks, list) { snprintf(line, MAXLINE, "%llu %s %llu-%llu nodeid %d pid %u owner %llx\n", - r->number, + (long long)r->number, po->ex ? "WR" : "RD", - po->start, po->end, - po->nodeid, po->pid, po->owner); + (long long)po->start, (long long)po->end, + po->nodeid, po->pid, (long long)po->owner); rv = do_write(fd, line, strlen(line)); } @@ -1538,10 +1562,11 @@ 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, + (long long)r->number, w->info.ex ? "WR" : "RD", - w->info.start, w->info.end, - w->info.nodeid, w->info.pid, w->info.owner); + (long long)w->info.start, (long long)w->info.end, + w->info.nodeid, w->info.pid, + (long long)w->info.owner); rv = do_write(fd, line, strlen(line)); } --- cluster/group/gfs_controld/recover.c 2007/06/08 19:01:11 1.31 +++ cluster/group/gfs_controld/recover.c 2007/07/11 17:01:23 1.32 @@ -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; }