Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
[safe/jmp/linux-2.6] / fs / ocfs2 / dlm / dlmdebug.c
index d7decaa..ca46002 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/highmem.h>
-#include <linux/utsname.h>
 #include <linux/sysctl.h>
 #include <linux/spinlock.h>
 #include <linux/debugfs.h>
@@ -287,18 +286,8 @@ static int stringify_nodemap(unsigned long *nodemap, int maxnodes,
 static int dump_mle(struct dlm_master_list_entry *mle, char *buf, int len)
 {
        int out = 0;
-       unsigned int namelen;
-       unsigned char *name;
        char *mle_type;
 
-       if (mle->type != DLM_MLE_MASTER) {
-               name = mle->u.mlename.name;
-               namelen = mle->u.mlename.len;
-       } else {
-               name  = (unsigned char *)mle->u.mleres->lockname.name;
-               namelen = mle->u.mleres->lockname.len;
-       }
-
        if (mle->type == DLM_MLE_BLOCK)
                mle_type = "BLK";
        else if (mle->type == DLM_MLE_MASTER)
@@ -306,7 +295,7 @@ static int dump_mle(struct dlm_master_list_entry *mle, char *buf, int len)
        else
                mle_type = "MIG";
 
-       out += stringify_lockname(name, namelen, buf + out, len - out);
+       out += stringify_lockname(mle->mname, mle->mnamelen, buf + out, len - out);
        out += snprintf(buf + out, len - out,
                        "\t%3s\tmas=%3u\tnew=%3u\tevt=%1d\tuse=%1d\tref=%3d\n",
                        mle_type, mle->master, mle->new_master,
@@ -504,7 +493,7 @@ static int debug_mle_print(struct dlm_ctxt *dlm, struct debug_buffer *db)
        struct hlist_head *bucket;
        struct hlist_node *list;
        int i, out = 0;
-       unsigned long total = 0;
+       unsigned long total = 0, longest = 0, bktcnt;
 
        out += snprintf(db->buf + out, db->len - out,
                        "Dumping MLEs for Domain: %s\n", dlm->name);
@@ -516,15 +505,18 @@ static int debug_mle_print(struct dlm_ctxt *dlm, struct debug_buffer *db)
                        mle = hlist_entry(list, struct dlm_master_list_entry,
                                          master_hash_node);
                        ++total;
+                       ++bktcnt;
                        if (db->len - out < 200)
                                continue;
                        out += dump_mle(mle, db->buf + out, db->len - out);
                }
+               longest = max(longest, bktcnt);
+               bktcnt = 0;
        }
        spin_unlock(&dlm->master_lock);
 
        out += snprintf(db->buf + out, db->len - out,
-                       "Total on list: %ld\n", total);
+                       "Total: %ld, Longest: %ld\n", total, longest);
        return out;
 }
 
@@ -690,7 +682,7 @@ static int lockres_seq_show(struct seq_file *s, void *v)
        return 0;
 }
 
-static struct seq_operations debug_lockres_ops = {
+static const struct seq_operations debug_lockres_ops = {
        .start =        lockres_seq_start,
        .stop =         lockres_seq_stop,
        .next =         lockres_seq_next,
@@ -763,6 +755,8 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db)
        int out = 0;
        struct dlm_reco_node_data *node;
        char *state;
+       int cur_mles = 0, tot_mles = 0;
+       int i;
 
        spin_lock(&dlm->spinlock);
 
@@ -805,6 +799,40 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db)
                                 db->buf + out, db->len - out);
        out += snprintf(db->buf + out, db->len - out, "\n");
 
+       /* Lock Resources: xxx (xxx) */
+       out += snprintf(db->buf + out, db->len - out,
+                       "Lock Resources: %d (%d)\n",
+                       atomic_read(&dlm->res_cur_count),
+                       atomic_read(&dlm->res_tot_count));
+
+       for (i = 0; i < DLM_MLE_NUM_TYPES; ++i)
+               tot_mles += atomic_read(&dlm->mle_tot_count[i]);
+
+       for (i = 0; i < DLM_MLE_NUM_TYPES; ++i)
+               cur_mles += atomic_read(&dlm->mle_cur_count[i]);
+
+       /* MLEs: xxx (xxx) */
+       out += snprintf(db->buf + out, db->len - out,
+                       "MLEs: %d (%d)\n", cur_mles, tot_mles);
+
+       /*  Blocking: xxx (xxx) */
+       out += snprintf(db->buf + out, db->len - out,
+                       "  Blocking: %d (%d)\n",
+                       atomic_read(&dlm->mle_cur_count[DLM_MLE_BLOCK]),
+                       atomic_read(&dlm->mle_tot_count[DLM_MLE_BLOCK]));
+
+       /*  Mastery: xxx (xxx) */
+       out += snprintf(db->buf + out, db->len - out,
+                       "  Mastery: %d (%d)\n",
+                       atomic_read(&dlm->mle_cur_count[DLM_MLE_MASTER]),
+                       atomic_read(&dlm->mle_tot_count[DLM_MLE_MASTER]));
+
+       /*  Migration: xxx (xxx) */
+       out += snprintf(db->buf + out, db->len - out,
+                       "  Migration: %d (%d)\n",
+                       atomic_read(&dlm->mle_cur_count[DLM_MLE_MIGRATION]),
+                       atomic_read(&dlm->mle_tot_count[DLM_MLE_MIGRATION]));
+
        /* Lists: Dirty=Empty  Purge=InUse  PendingASTs=Empty  ... */
        out += snprintf(db->buf + out, db->len - out,
                        "Lists: Dirty=%s  Purge=%s  PendingASTs=%s  "