public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: David Teigland <teigland@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: master - dlm_controld/gfs_controld: dump unused resources
Date: Thu, 11 Dec 2008 23:47:00 -0000	[thread overview]
Message-ID: <20081211234628.8DA9AC07B8@lists.fedorahosted.org> (raw)

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",


                 reply	other threads:[~2008-12-11 23:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081211234628.8DA9AC07B8@lists.fedorahosted.org \
    --to=teigland@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).