aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fscache/page.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-11-19 13:11:08 -0500
committerDavid Howells <dhowells@redhat.com>2009-11-19 13:11:08 -0500
commit52bd75fdb135d6133d878ae60c6e7e3f4ebc1cfc (patch)
tree4fad4fa37ce533c520a4575e5b7df90e19c6a666 /fs/fscache/page.c
parent4fbf4291aa15926cd4fdca0ffe9122e89d0459db (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/page.c')
-rw-r--r--fs/fscache/page.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index c5973e38ce39..250dfd34c07b 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -71,7 +71,9 @@ static void fscache_attr_changed_op(struct fscache_operation *op)
71 71
72 if (fscache_object_is_active(object)) { 72 if (fscache_object_is_active(object)) {
73 fscache_set_op_state(op, "CallFS"); 73 fscache_set_op_state(op, "CallFS");
74 fscache_stat(&fscache_n_cop_attr_changed);
74 ret = object->cache->ops->attr_changed(object); 75 ret = object->cache->ops->attr_changed(object);
76 fscache_stat_d(&fscache_n_cop_attr_changed);
75 fscache_set_op_state(op, "Done"); 77 fscache_set_op_state(op, "Done");
76 if (ret < 0) 78 if (ret < 0)
77 fscache_abort_object(object); 79 fscache_abort_object(object);
@@ -300,11 +302,15 @@ int __fscache_read_or_alloc_page(struct fscache_cookie *cookie,
300 302
301 /* ask the cache to honour the operation */ 303 /* ask the cache to honour the operation */
302 if (test_bit(FSCACHE_COOKIE_NO_DATA_YET, &object->cookie->flags)) { 304 if (test_bit(FSCACHE_COOKIE_NO_DATA_YET, &object->cookie->flags)) {
305 fscache_stat(&fscache_n_cop_allocate_page);
303 ret = object->cache->ops->allocate_page(op, page, gfp); 306 ret = object->cache->ops->allocate_page(op, page, gfp);
307 fscache_stat_d(&fscache_n_cop_allocate_page);
304 if (ret == 0) 308 if (ret == 0)
305 ret = -ENODATA; 309 ret = -ENODATA;
306 } else { 310 } else {
311 fscache_stat(&fscache_n_cop_read_or_alloc_page);
307 ret = object->cache->ops->read_or_alloc_page(op, page, gfp); 312 ret = object->cache->ops->read_or_alloc_page(op, page, gfp);
313 fscache_stat_d(&fscache_n_cop_read_or_alloc_page);
308 } 314 }
309 315
310 if (ret == -ENOMEM) 316 if (ret == -ENOMEM)
@@ -358,7 +364,6 @@ int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
358 void *context, 364 void *context,
359 gfp_t gfp) 365 gfp_t gfp)
360{ 366{
361 fscache_pages_retrieval_func_t func;
362 struct fscache_retrieval *op; 367 struct fscache_retrieval *op;
363 struct fscache_object *object; 368 struct fscache_object *object;
364 int ret; 369 int ret;
@@ -413,11 +418,17 @@ int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
413 } 418 }
414 419
415 /* ask the cache to honour the operation */ 420 /* ask the cache to honour the operation */
416 if (test_bit(FSCACHE_COOKIE_NO_DATA_YET, &object->cookie->flags)) 421 if (test_bit(FSCACHE_COOKIE_NO_DATA_YET, &object->cookie->flags)) {
417 func = object->cache->ops->allocate_pages; 422 fscache_stat(&fscache_n_cop_allocate_pages);
418 else 423 ret = object->cache->ops->allocate_pages(
419 func = object->cache->ops->read_or_alloc_pages; 424 op, pages, nr_pages, gfp);
420 ret = func(op, pages, nr_pages, gfp); 425 fscache_stat_d(&fscache_n_cop_allocate_pages);
426 } else {
427 fscache_stat(&fscache_n_cop_read_or_alloc_pages);
428 ret = object->cache->ops->read_or_alloc_pages(
429 op, pages, nr_pages, gfp);
430 fscache_stat_d(&fscache_n_cop_read_or_alloc_pages);
431 }
421 432
422 if (ret == -ENOMEM) 433 if (ret == -ENOMEM)
423 fscache_stat(&fscache_n_retrievals_nomem); 434 fscache_stat(&fscache_n_retrievals_nomem);
@@ -500,7 +511,9 @@ int __fscache_alloc_page(struct fscache_cookie *cookie,
500 } 511 }
501 512
502 /* ask the cache to honour the operation */ 513 /* ask the cache to honour the operation */
514 fscache_stat(&fscache_n_cop_allocate_page);
503 ret = object->cache->ops->allocate_page(op, page, gfp); 515 ret = object->cache->ops->allocate_page(op, page, gfp);
516 fscache_stat_d(&fscache_n_cop_allocate_page);
504 517
505 if (ret < 0) 518 if (ret < 0)
506 fscache_stat(&fscache_n_allocs_nobufs); 519 fscache_stat(&fscache_n_allocs_nobufs);
@@ -578,7 +591,9 @@ static void fscache_write_op(struct fscache_operation *_op)
578 591
579 if (page) { 592 if (page) {
580 fscache_set_op_state(&op->op, "Store"); 593 fscache_set_op_state(&op->op, "Store");
594 fscache_stat(&fscache_n_cop_write_page);
581 ret = object->cache->ops->write_page(op, page); 595 ret = object->cache->ops->write_page(op, page);
596 fscache_stat_d(&fscache_n_cop_write_page);
582 fscache_set_op_state(&op->op, "EndWrite"); 597 fscache_set_op_state(&op->op, "EndWrite");
583 fscache_end_page_write(cookie, page); 598 fscache_end_page_write(cookie, page);
584 page_cache_release(page); 599 page_cache_release(page);
@@ -786,7 +801,9 @@ void __fscache_uncache_page(struct fscache_cookie *cookie, struct page *page)
786 if (TestClearPageFsCache(page) && 801 if (TestClearPageFsCache(page) &&
787 object->cache->ops->uncache_page) { 802 object->cache->ops->uncache_page) {
788 /* the cache backend releases the cookie lock */ 803 /* the cache backend releases the cookie lock */
804 fscache_stat(&fscache_n_cop_uncache_page);
789 object->cache->ops->uncache_page(object, page); 805 object->cache->ops->uncache_page(object, page);
806 fscache_stat_d(&fscache_n_cop_uncache_page);
790 goto done; 807 goto done;
791 } 808 }
792 809