diff options
author | Sunil Mushran <sunil.mushran@oracle.com> | 2009-02-26 18:00:44 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-04-03 14:39:21 -0400 |
commit | 6800791ab773453bdec337efb3f0cec6557f3bb3 (patch) | |
tree | c4f678c75d17aae11eae6e71d16962c7526da194 /fs/ocfs2/dlm | |
parent | 2041d8fdcec7603401829f60810c1dbd5e96c043 (diff) |
ocfs2/dlm: Improve lockres counts
This patch replaces the lockres counts that tracked the number number of
locally and remotely mastered lockres' with a current and total count. The
total count is the number of lockres' that have been created since the dlm
domain was created.
The number of locally and remotely mastered counts can be computed using
the locking_state output.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/dlm')
-rw-r--r-- | fs/ocfs2/dlm/dlmcommon.h | 5 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmdebug.c | 12 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmdomain.c | 5 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 27 |
4 files changed, 11 insertions, 38 deletions
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 67b3447a292e..e5026ce862ad 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -159,9 +159,8 @@ struct dlm_ctxt | |||
159 | /* these give a really vague idea of the system load */ | 159 | /* these give a really vague idea of the system load */ |
160 | atomic_t mle_tot_count[DLM_MLE_NUM_TYPES]; | 160 | atomic_t mle_tot_count[DLM_MLE_NUM_TYPES]; |
161 | atomic_t mle_cur_count[DLM_MLE_NUM_TYPES]; | 161 | atomic_t mle_cur_count[DLM_MLE_NUM_TYPES]; |
162 | atomic_t local_resources; | 162 | atomic_t res_tot_count; |
163 | atomic_t remote_resources; | 163 | atomic_t res_cur_count; |
164 | atomic_t unknown_resources; | ||
165 | 164 | ||
166 | struct dlm_debug_ctxt *dlm_debug_ctxt; | 165 | struct dlm_debug_ctxt *dlm_debug_ctxt; |
167 | struct dentry *dlm_debugfs_subroot; | 166 | struct dentry *dlm_debugfs_subroot; |
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c index 336a98e82eba..d7decaa687e6 100644 --- a/fs/ocfs2/dlm/dlmdebug.c +++ b/fs/ocfs2/dlm/dlmdebug.c | |||
@@ -763,12 +763,6 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
763 | int out = 0; | 763 | int out = 0; |
764 | struct dlm_reco_node_data *node; | 764 | struct dlm_reco_node_data *node; |
765 | char *state; | 765 | char *state; |
766 | int lres, rres, ures, tres; | ||
767 | |||
768 | lres = atomic_read(&dlm->local_resources); | ||
769 | rres = atomic_read(&dlm->remote_resources); | ||
770 | ures = atomic_read(&dlm->unknown_resources); | ||
771 | tres = lres + rres + ures; | ||
772 | 766 | ||
773 | spin_lock(&dlm->spinlock); | 767 | spin_lock(&dlm->spinlock); |
774 | 768 | ||
@@ -811,12 +805,6 @@ static int debug_state_print(struct dlm_ctxt *dlm, struct debug_buffer *db) | |||
811 | db->buf + out, db->len - out); | 805 | db->buf + out, db->len - out); |
812 | out += snprintf(db->buf + out, db->len - out, "\n"); | 806 | out += snprintf(db->buf + out, db->len - out, "\n"); |
813 | 807 | ||
814 | /* Mastered Resources Total: xxx Locally: xxx Remotely: ... */ | ||
815 | out += snprintf(db->buf + out, db->len - out, | ||
816 | "Mastered Resources Total: %d Locally: %d " | ||
817 | "Remotely: %d Unknown: %d\n", | ||
818 | tres, lres, rres, ures); | ||
819 | |||
820 | /* Lists: Dirty=Empty Purge=InUse PendingASTs=Empty ... */ | 808 | /* Lists: Dirty=Empty Purge=InUse PendingASTs=Empty ... */ |
821 | out += snprintf(db->buf + out, db->len - out, | 809 | out += snprintf(db->buf + out, db->len - out, |
822 | "Lists: Dirty=%s Purge=%s PendingASTs=%s " | 810 | "Lists: Dirty=%s Purge=%s PendingASTs=%s " |
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 0479bdf91c2b..4d9e6b288dd8 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -1604,10 +1604,9 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain, | |||
1604 | 1604 | ||
1605 | dlm->reco.new_master = O2NM_INVALID_NODE_NUM; | 1605 | dlm->reco.new_master = O2NM_INVALID_NODE_NUM; |
1606 | dlm->reco.dead_node = O2NM_INVALID_NODE_NUM; | 1606 | dlm->reco.dead_node = O2NM_INVALID_NODE_NUM; |
1607 | atomic_set(&dlm->local_resources, 0); | ||
1608 | atomic_set(&dlm->remote_resources, 0); | ||
1609 | atomic_set(&dlm->unknown_resources, 0); | ||
1610 | 1607 | ||
1608 | atomic_set(&dlm->res_tot_count, 0); | ||
1609 | atomic_set(&dlm->res_cur_count, 0); | ||
1611 | for (i = 0; i < DLM_MLE_NUM_TYPES; ++i) { | 1610 | for (i = 0; i < DLM_MLE_NUM_TYPES; ++i) { |
1612 | atomic_set(&dlm->mle_tot_count[i], 0); | 1611 | atomic_set(&dlm->mle_tot_count[i], 0); |
1613 | atomic_set(&dlm->mle_cur_count[i], 0); | 1612 | atomic_set(&dlm->mle_cur_count[i], 0); |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index acfc9288d5cd..d70cdd51de0f 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -517,15 +517,6 @@ static void dlm_set_lockres_owner(struct dlm_ctxt *dlm, | |||
517 | { | 517 | { |
518 | assert_spin_locked(&res->spinlock); | 518 | assert_spin_locked(&res->spinlock); |
519 | 519 | ||
520 | mlog_entry("%.*s, %u\n", res->lockname.len, res->lockname.name, owner); | ||
521 | |||
522 | if (owner == dlm->node_num) | ||
523 | atomic_inc(&dlm->local_resources); | ||
524 | else if (owner == DLM_LOCK_RES_OWNER_UNKNOWN) | ||
525 | atomic_inc(&dlm->unknown_resources); | ||
526 | else | ||
527 | atomic_inc(&dlm->remote_resources); | ||
528 | |||
529 | res->owner = owner; | 520 | res->owner = owner; |
530 | } | 521 | } |
531 | 522 | ||
@@ -534,17 +525,8 @@ void dlm_change_lockres_owner(struct dlm_ctxt *dlm, | |||
534 | { | 525 | { |
535 | assert_spin_locked(&res->spinlock); | 526 | assert_spin_locked(&res->spinlock); |
536 | 527 | ||
537 | if (owner == res->owner) | 528 | if (owner != res->owner) |
538 | return; | 529 | dlm_set_lockres_owner(dlm, res, owner); |
539 | |||
540 | if (res->owner == dlm->node_num) | ||
541 | atomic_dec(&dlm->local_resources); | ||
542 | else if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) | ||
543 | atomic_dec(&dlm->unknown_resources); | ||
544 | else | ||
545 | atomic_dec(&dlm->remote_resources); | ||
546 | |||
547 | dlm_set_lockres_owner(dlm, res, owner); | ||
548 | } | 530 | } |
549 | 531 | ||
550 | 532 | ||
@@ -573,6 +555,8 @@ static void dlm_lockres_release(struct kref *kref) | |||
573 | } | 555 | } |
574 | spin_unlock(&dlm->track_lock); | 556 | spin_unlock(&dlm->track_lock); |
575 | 557 | ||
558 | atomic_dec(&dlm->res_cur_count); | ||
559 | |||
576 | dlm_put(dlm); | 560 | dlm_put(dlm); |
577 | 561 | ||
578 | if (!hlist_unhashed(&res->hash_node) || | 562 | if (!hlist_unhashed(&res->hash_node) || |
@@ -653,6 +637,9 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm, | |||
653 | 637 | ||
654 | kref_init(&res->refs); | 638 | kref_init(&res->refs); |
655 | 639 | ||
640 | atomic_inc(&dlm->res_tot_count); | ||
641 | atomic_inc(&dlm->res_cur_count); | ||
642 | |||
656 | /* just for consistency */ | 643 | /* just for consistency */ |
657 | spin_lock(&res->spinlock); | 644 | spin_lock(&res->spinlock); |
658 | dlm_set_lockres_owner(dlm, res, DLM_LOCK_RES_OWNER_UNKNOWN); | 645 | dlm_set_lockres_owner(dlm, res, DLM_LOCK_RES_OWNER_UNKNOWN); |