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/dlmmaster.c | |
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/dlmmaster.c')
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 27 |
1 files changed, 7 insertions, 20 deletions
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); |