diff options
author | David Howells <dhowells@redhat.com> | 2009-11-19 13:11:08 -0500 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2009-11-19 13:11:08 -0500 |
commit | 52bd75fdb135d6133d878ae60c6e7e3f4ebc1cfc (patch) | |
tree | 4fad4fa37ce533c520a4575e5b7df90e19c6a666 /fs/fscache/object.c | |
parent | 4fbf4291aa15926cd4fdca0ffe9122e89d0459db (diff) |
FS-Cache: Add counters for entry/exit to/from cache operation functions
Count entries to and exits from cache operation table functions. Maintain
these as a single counter that's added to or removed from as appropriate.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/fscache/object.c')
-rw-r--r-- | fs/fscache/object.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/fs/fscache/object.c b/fs/fscache/object.c index ad1644f073bd..0d65c0c92b46 100644 --- a/fs/fscache/object.c +++ b/fs/fscache/object.c | |||
@@ -144,13 +144,17 @@ static void fscache_object_state_machine(struct fscache_object *object) | |||
144 | case FSCACHE_OBJECT_UPDATING: | 144 | case FSCACHE_OBJECT_UPDATING: |
145 | clear_bit(FSCACHE_OBJECT_EV_UPDATE, &object->events); | 145 | clear_bit(FSCACHE_OBJECT_EV_UPDATE, &object->events); |
146 | fscache_stat(&fscache_n_updates_run); | 146 | fscache_stat(&fscache_n_updates_run); |
147 | fscache_stat(&fscache_n_cop_update_object); | ||
147 | object->cache->ops->update_object(object); | 148 | object->cache->ops->update_object(object); |
149 | fscache_stat_d(&fscache_n_cop_update_object); | ||
148 | goto active_transit; | 150 | goto active_transit; |
149 | 151 | ||
150 | /* handle an object dying during lookup or creation */ | 152 | /* handle an object dying during lookup or creation */ |
151 | case FSCACHE_OBJECT_LC_DYING: | 153 | case FSCACHE_OBJECT_LC_DYING: |
152 | object->event_mask &= ~(1 << FSCACHE_OBJECT_EV_UPDATE); | 154 | object->event_mask &= ~(1 << FSCACHE_OBJECT_EV_UPDATE); |
155 | fscache_stat(&fscache_n_cop_lookup_complete); | ||
153 | object->cache->ops->lookup_complete(object); | 156 | object->cache->ops->lookup_complete(object); |
157 | fscache_stat_d(&fscache_n_cop_lookup_complete); | ||
154 | 158 | ||
155 | spin_lock(&object->lock); | 159 | spin_lock(&object->lock); |
156 | object->state = FSCACHE_OBJECT_DYING; | 160 | object->state = FSCACHE_OBJECT_DYING; |
@@ -416,7 +420,9 @@ static void fscache_initialise_object(struct fscache_object *object) | |||
416 | * binding on to us, so we need to make sure we don't | 420 | * binding on to us, so we need to make sure we don't |
417 | * add ourself to the list multiple times */ | 421 | * add ourself to the list multiple times */ |
418 | if (list_empty(&object->dep_link)) { | 422 | if (list_empty(&object->dep_link)) { |
423 | fscache_stat(&fscache_n_cop_grab_object); | ||
419 | object->cache->ops->grab_object(object); | 424 | object->cache->ops->grab_object(object); |
425 | fscache_stat_d(&fscache_n_cop_grab_object); | ||
420 | list_add(&object->dep_link, | 426 | list_add(&object->dep_link, |
421 | &parent->dependents); | 427 | &parent->dependents); |
422 | 428 | ||
@@ -478,7 +484,9 @@ static void fscache_lookup_object(struct fscache_object *object) | |||
478 | object->cache->tag->name); | 484 | object->cache->tag->name); |
479 | 485 | ||
480 | fscache_stat(&fscache_n_object_lookups); | 486 | fscache_stat(&fscache_n_object_lookups); |
487 | fscache_stat(&fscache_n_cop_lookup_object); | ||
481 | object->cache->ops->lookup_object(object); | 488 | object->cache->ops->lookup_object(object); |
489 | fscache_stat_d(&fscache_n_cop_lookup_object); | ||
482 | 490 | ||
483 | if (test_bit(FSCACHE_OBJECT_EV_ERROR, &object->events)) | 491 | if (test_bit(FSCACHE_OBJECT_EV_ERROR, &object->events)) |
484 | set_bit(FSCACHE_COOKIE_UNAVAILABLE, &cookie->flags); | 492 | set_bit(FSCACHE_COOKIE_UNAVAILABLE, &cookie->flags); |
@@ -602,7 +610,9 @@ static void fscache_object_available(struct fscache_object *object) | |||
602 | } | 610 | } |
603 | spin_unlock(&object->lock); | 611 | spin_unlock(&object->lock); |
604 | 612 | ||
613 | fscache_stat(&fscache_n_cop_lookup_complete); | ||
605 | object->cache->ops->lookup_complete(object); | 614 | object->cache->ops->lookup_complete(object); |
615 | fscache_stat_d(&fscache_n_cop_lookup_complete); | ||
606 | fscache_enqueue_dependents(object); | 616 | fscache_enqueue_dependents(object); |
607 | 617 | ||
608 | fscache_hist(fscache_obj_instantiate_histogram, object->lookup_jif); | 618 | fscache_hist(fscache_obj_instantiate_histogram, object->lookup_jif); |
@@ -625,7 +635,9 @@ static void fscache_drop_object(struct fscache_object *object) | |||
625 | list_del_init(&object->cache_link); | 635 | list_del_init(&object->cache_link); |
626 | spin_unlock(&cache->object_list_lock); | 636 | spin_unlock(&cache->object_list_lock); |
627 | 637 | ||
638 | fscache_stat(&fscache_n_cop_drop_object); | ||
628 | cache->ops->drop_object(object); | 639 | cache->ops->drop_object(object); |
640 | fscache_stat_d(&fscache_n_cop_drop_object); | ||
629 | 641 | ||
630 | if (parent) { | 642 | if (parent) { |
631 | _debug("release parent OBJ%x {%d}", | 643 | _debug("release parent OBJ%x {%d}", |
@@ -640,7 +652,9 @@ static void fscache_drop_object(struct fscache_object *object) | |||
640 | } | 652 | } |
641 | 653 | ||
642 | /* this just shifts the object release to the slow work processor */ | 654 | /* this just shifts the object release to the slow work processor */ |
655 | fscache_stat(&fscache_n_cop_put_object); | ||
643 | object->cache->ops->put_object(object); | 656 | object->cache->ops->put_object(object); |
657 | fscache_stat_d(&fscache_n_cop_put_object); | ||
644 | 658 | ||
645 | _leave(""); | 659 | _leave(""); |
646 | } | 660 | } |
@@ -730,8 +744,12 @@ static int fscache_object_slow_work_get_ref(struct slow_work *work) | |||
730 | { | 744 | { |
731 | struct fscache_object *object = | 745 | struct fscache_object *object = |
732 | container_of(work, struct fscache_object, work); | 746 | container_of(work, struct fscache_object, work); |
747 | int ret; | ||
733 | 748 | ||
734 | return object->cache->ops->grab_object(object) ? 0 : -EAGAIN; | 749 | fscache_stat(&fscache_n_cop_grab_object); |
750 | ret = object->cache->ops->grab_object(object) ? 0 : -EAGAIN; | ||
751 | fscache_stat_d(&fscache_n_cop_grab_object); | ||
752 | return ret; | ||
735 | } | 753 | } |
736 | 754 | ||
737 | /* | 755 | /* |
@@ -742,7 +760,9 @@ static void fscache_object_slow_work_put_ref(struct slow_work *work) | |||
742 | struct fscache_object *object = | 760 | struct fscache_object *object = |
743 | container_of(work, struct fscache_object, work); | 761 | container_of(work, struct fscache_object, work); |
744 | 762 | ||
745 | return object->cache->ops->put_object(object); | 763 | fscache_stat(&fscache_n_cop_put_object); |
764 | object->cache->ops->put_object(object); | ||
765 | fscache_stat_d(&fscache_n_cop_put_object); | ||
746 | } | 766 | } |
747 | 767 | ||
748 | /* | 768 | /* |
@@ -779,7 +799,9 @@ static void fscache_enqueue_dependents(struct fscache_object *object) | |||
779 | 799 | ||
780 | /* sort onto appropriate lists */ | 800 | /* sort onto appropriate lists */ |
781 | fscache_enqueue_object(dep); | 801 | fscache_enqueue_object(dep); |
802 | fscache_stat(&fscache_n_cop_put_object); | ||
782 | dep->cache->ops->put_object(dep); | 803 | dep->cache->ops->put_object(dep); |
804 | fscache_stat_d(&fscache_n_cop_put_object); | ||
783 | 805 | ||
784 | if (!list_empty(&object->dependents)) | 806 | if (!list_empty(&object->dependents)) |
785 | cond_resched_lock(&object->lock); | 807 | cond_resched_lock(&object->lock); |