public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: master - dlm_controld/gfs_controld: dump unused resources
@ 2008-12-11 23:47 David Teigland
  0 siblings, 0 replies; only message in thread
From: David Teigland @ 2008-12-11 23:47 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=2abc9df513fe5532c9d02b8102604cda4a4dd569
Commit:        2abc9df513fe5532c9d02b8102604cda4a4dd569
Parent:        1e3b9e7642386349587e8be3ff8c390507a14ed3
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Thu Dec 11 16:25:04 2008 -0600
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Thu Dec 11 17:43:52 2008 -0600

dlm_controld/gfs_controld: dump unused resources

Unused/cached resources have owner state that's useful to
see in the debug dump.

Signed-off-by: David Teigland <teigland@redhat.com>
---
 group/dlm_controld/plock.c |   20 ++++++++++++++++++++
 group/gfs_controld/plock.c |   18 ++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
index a59f5b8..75f2050 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -2105,13 +2105,33 @@ int fill_plock_dump_buf(struct lockspace *ls)
 	struct posix_lock *po;
 	struct lock_waiter *w;
 	struct resource *r;
+	struct timeval now;
 	int rv = 0;
 	int len = DLMC_DUMP_SIZE, pos = 0, ret;
 
 	memset(plock_dump_buf, 0, sizeof(plock_dump_buf));
 	plock_dump_len = 0;
 
+	gettimeofday(&now, NULL);
+
 	list_for_each_entry(r, &ls->plock_resources, list) {
+
+		if (list_empty(&r->locks) &&
+		    list_empty(&r->waiters) &&
+		    list_empty(&r->pending)) {
+			ret = snprintf(plock_dump_buf + pos, len - pos,
+			      "%llu rown %d unused_ms %llu\n",
+			      (unsigned long long)r->number, r->owner,
+			      (unsigned long long)time_diff_ms(&r->last_access,
+				      			       &now));
+			if (ret >= len - pos) {
+				rv = -ENOSPC;
+				goto out;
+			}
+			pos += ret;
+			continue;
+		}
+
 		list_for_each_entry(po, &r->locks, list) {
 			ret = snprintf(plock_dump_buf + pos, len - pos,
 			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d\n",
diff --git a/group/gfs_controld/plock.c b/group/gfs_controld/plock.c
index 345235d..122e161 100644
--- a/group/gfs_controld/plock.c
+++ b/group/gfs_controld/plock.c
@@ -2192,6 +2192,7 @@ int fill_plock_dump_buf(struct mountgroup *mg)
 	struct posix_lock *po;
 	struct lock_waiter *w;
 	struct resource *r;
+	struct timeval now;
 	int rv = 0;
 	int len = GFSC_DUMP_SIZE, pos = 0, ret;
 
@@ -2199,6 +2200,23 @@ int fill_plock_dump_buf(struct mountgroup *mg)
 	plock_dump_len = 0;
 
 	list_for_each_entry(r, &mg->plock_resources, list) {
+
+		if (list_empty(&r->locks) &&
+		    list_empty(&r->waiters) &&
+		    list_empty(&r->pending)) {
+			ret = snprintf(plock_dump_buf + pos, len - pos,
+			      "%llu rown %d unused_ms %llu\n",
+			      (unsigned long long)r->number, r->owner,
+			      (unsigned long long)time_diff_ms(&r->last_access,
+							       &now));
+			if (ret >= len - pos) {
+				rv = -ENOSPC;
+				goto out;
+			}
+			pos += ret;
+			continue;
+		}
+
 		list_for_each_entry(po, &r->locks, list) {
 			ret = snprintf(plock_dump_buf + pos, len - pos,
 			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d\n",


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-11 23:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-11 23:47 cluster: master - dlm_controld/gfs_controld: dump unused resources David Teigland

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