diff options
| -rw-r--r-- | fs/ocfs2/buffer_head_io.c | 3 | ||||
| -rw-r--r-- | fs/ocfs2/cluster/masklog.c | 1 | ||||
| -rw-r--r-- | fs/ocfs2/cluster/masklog.h | 1 | ||||
| -rw-r--r-- | fs/ocfs2/ocfs2_trace.h | 42 | ||||
| -rw-r--r-- | fs/ocfs2/uptodate.c | 73 |
5 files changed, 79 insertions, 41 deletions
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c index d1cf9abcd827..5d18ad10c27f 100644 --- a/fs/ocfs2/buffer_head_io.c +++ b/fs/ocfs2/buffer_head_io.c | |||
| @@ -247,8 +247,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, | |||
| 247 | */ | 247 | */ |
| 248 | 248 | ||
| 249 | if (!ignore_cache && !ocfs2_buffer_uptodate(ci, bh)) { | 249 | if (!ignore_cache && !ocfs2_buffer_uptodate(ci, bh)) { |
| 250 | mlog(ML_UPTODATE, | 250 | trace_ocfs2_read_blocks_from_disk( |
| 251 | "bh (%llu), owner %llu not uptodate\n", | ||
| 252 | (unsigned long long)bh->b_blocknr, | 251 | (unsigned long long)bh->b_blocknr, |
| 253 | (unsigned long long)ocfs2_metadata_cache_owner(ci)); | 252 | (unsigned long long)ocfs2_metadata_cache_owner(ci)); |
| 254 | /* We're using ignore_cache here to say | 253 | /* We're using ignore_cache here to say |
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c index d845ccef2408..bbea7b6cb4d3 100644 --- a/fs/ocfs2/cluster/masklog.c +++ b/fs/ocfs2/cluster/masklog.c | |||
| @@ -93,7 +93,6 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = { | |||
| 93 | define_mask(DLM_RECOVERY), | 93 | define_mask(DLM_RECOVERY), |
| 94 | define_mask(AIO), | 94 | define_mask(AIO), |
| 95 | define_mask(DLM_GLUE), | 95 | define_mask(DLM_GLUE), |
| 96 | define_mask(UPTODATE), | ||
| 97 | define_mask(VOTE), | 96 | define_mask(VOTE), |
| 98 | define_mask(CONN), | 97 | define_mask(CONN), |
| 99 | define_mask(QUORUM), | 98 | define_mask(QUORUM), |
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h index ad267f614528..7a86add27f69 100644 --- a/fs/ocfs2/cluster/masklog.h +++ b/fs/ocfs2/cluster/masklog.h | |||
| @@ -95,7 +95,6 @@ | |||
| 95 | #define ML_DLM_RECOVERY 0x0000000000001000ULL /* dlm master functions */ | 95 | #define ML_DLM_RECOVERY 0x0000000000001000ULL /* dlm master functions */ |
| 96 | #define ML_AIO 0x0000000000002000ULL /* ocfs2 aio read and write */ | 96 | #define ML_AIO 0x0000000000002000ULL /* ocfs2 aio read and write */ |
| 97 | #define ML_DLM_GLUE 0x0000000000080000ULL /* ocfs2 dlm glue layer */ | 97 | #define ML_DLM_GLUE 0x0000000000080000ULL /* ocfs2 dlm glue layer */ |
| 98 | #define ML_UPTODATE 0x0000000000200000ULL /* ocfs2 caching sequence #'s */ | ||
| 99 | #define ML_VOTE 0x0000000001000000ULL /* ocfs2 node messaging */ | 98 | #define ML_VOTE 0x0000000001000000ULL /* ocfs2 node messaging */ |
| 100 | #define ML_CONN 0x0000000004000000ULL /* net connection management */ | 99 | #define ML_CONN 0x0000000004000000ULL /* net connection management */ |
| 101 | #define ML_QUORUM 0x0000000008000000ULL /* net connection quorum */ | 100 | #define ML_QUORUM 0x0000000008000000ULL /* net connection quorum */ |
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h index 90dc79a22a59..a1dae5bb54ac 100644 --- a/fs/ocfs2/ocfs2_trace.h +++ b/fs/ocfs2/ocfs2_trace.h | |||
| @@ -2649,6 +2649,8 @@ DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_read_blocks_sync); | |||
| 2649 | 2649 | ||
| 2650 | DEFINE_OCFS2_ULL_EVENT(ocfs2_read_blocks_sync_jbd); | 2650 | DEFINE_OCFS2_ULL_EVENT(ocfs2_read_blocks_sync_jbd); |
| 2651 | 2651 | ||
| 2652 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_read_blocks_from_disk); | ||
| 2653 | |||
| 2652 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_read_blocks_bh); | 2654 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_read_blocks_bh); |
| 2653 | 2655 | ||
| 2654 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_read_blocks_end); | 2656 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_read_blocks_end); |
| @@ -2688,6 +2690,46 @@ TRACE_EVENT(ocfs2_read_blocks_begin, | |||
| 2688 | ); | 2690 | ); |
| 2689 | 2691 | ||
| 2690 | /* End of trace events for fs/ocfs2/buffer_head_io.c. */ | 2692 | /* End of trace events for fs/ocfs2/buffer_head_io.c. */ |
| 2693 | |||
| 2694 | /* Trace events for fs/ocfs2/uptodate.c. */ | ||
| 2695 | |||
| 2696 | DEFINE_OCFS2_ULL_EVENT(ocfs2_purge_copied_metadata_tree); | ||
| 2697 | |||
| 2698 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_metadata_cache_purge); | ||
| 2699 | |||
| 2700 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_buffer_cached_begin); | ||
| 2701 | |||
| 2702 | TRACE_EVENT(ocfs2_buffer_cached_end, | ||
| 2703 | TP_PROTO(int index, void *item), | ||
| 2704 | TP_ARGS(index, item), | ||
| 2705 | TP_STRUCT__entry( | ||
| 2706 | __field(int, index) | ||
| 2707 | __field(void *, item) | ||
| 2708 | ), | ||
| 2709 | TP_fast_assign( | ||
| 2710 | __entry->index = index; | ||
| 2711 | __entry->item = item; | ||
| 2712 | ), | ||
| 2713 | TP_printk("%d %p", __entry->index, __entry->item) | ||
| 2714 | ); | ||
| 2715 | |||
| 2716 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_append_cache_array); | ||
| 2717 | |||
| 2718 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_insert_cache_tree); | ||
| 2719 | |||
| 2720 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_expand_cache); | ||
| 2721 | |||
| 2722 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_set_buffer_uptodate); | ||
| 2723 | |||
| 2724 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_set_buffer_uptodate_begin); | ||
| 2725 | |||
| 2726 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_remove_metadata_array); | ||
| 2727 | |||
| 2728 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_remove_metadata_tree); | ||
| 2729 | |||
| 2730 | DEFINE_OCFS2_ULL_ULL_UINT_UINT_EVENT(ocfs2_remove_block_from_cache); | ||
| 2731 | |||
| 2732 | /* End of trace events for fs/ocfs2/uptodate.c. */ | ||
| 2691 | #endif /* _TRACE_OCFS2_H */ | 2733 | #endif /* _TRACE_OCFS2_H */ |
| 2692 | 2734 | ||
| 2693 | /* This part must be outside protection */ | 2735 | /* This part must be outside protection */ |
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c index a0a120e82b97..52eaf33d346f 100644 --- a/fs/ocfs2/uptodate.c +++ b/fs/ocfs2/uptodate.c | |||
| @@ -54,14 +54,13 @@ | |||
| 54 | #include <linux/buffer_head.h> | 54 | #include <linux/buffer_head.h> |
| 55 | #include <linux/rbtree.h> | 55 | #include <linux/rbtree.h> |
| 56 | 56 | ||
| 57 | #define MLOG_MASK_PREFIX ML_UPTODATE | ||
| 58 | |||
| 59 | #include <cluster/masklog.h> | 57 | #include <cluster/masklog.h> |
| 60 | 58 | ||
| 61 | #include "ocfs2.h" | 59 | #include "ocfs2.h" |
| 62 | 60 | ||
| 63 | #include "inode.h" | 61 | #include "inode.h" |
| 64 | #include "uptodate.h" | 62 | #include "uptodate.h" |
| 63 | #include "ocfs2_trace.h" | ||
| 65 | 64 | ||
| 66 | struct ocfs2_meta_cache_item { | 65 | struct ocfs2_meta_cache_item { |
| 67 | struct rb_node c_node; | 66 | struct rb_node c_node; |
| @@ -152,8 +151,8 @@ static unsigned int ocfs2_purge_copied_metadata_tree(struct rb_root *root) | |||
| 152 | while ((node = rb_last(root)) != NULL) { | 151 | while ((node = rb_last(root)) != NULL) { |
| 153 | item = rb_entry(node, struct ocfs2_meta_cache_item, c_node); | 152 | item = rb_entry(node, struct ocfs2_meta_cache_item, c_node); |
| 154 | 153 | ||
| 155 | mlog(0, "Purge item %llu\n", | 154 | trace_ocfs2_purge_copied_metadata_tree( |
| 156 | (unsigned long long) item->c_block); | 155 | (unsigned long long) item->c_block); |
| 157 | 156 | ||
| 158 | rb_erase(&item->c_node, root); | 157 | rb_erase(&item->c_node, root); |
| 159 | kmem_cache_free(ocfs2_uptodate_cachep, item); | 158 | kmem_cache_free(ocfs2_uptodate_cachep, item); |
| @@ -180,9 +179,9 @@ void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci) | |||
| 180 | tree = !(ci->ci_flags & OCFS2_CACHE_FL_INLINE); | 179 | tree = !(ci->ci_flags & OCFS2_CACHE_FL_INLINE); |
| 181 | to_purge = ci->ci_num_cached; | 180 | to_purge = ci->ci_num_cached; |
| 182 | 181 | ||
| 183 | mlog(0, "Purge %u %s items from Owner %llu\n", to_purge, | 182 | trace_ocfs2_metadata_cache_purge( |
| 184 | tree ? "array" : "tree", | 183 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 185 | (unsigned long long)ocfs2_metadata_cache_owner(ci)); | 184 | to_purge, tree); |
| 186 | 185 | ||
| 187 | /* If we're a tree, save off the root so that we can safely | 186 | /* If we're a tree, save off the root so that we can safely |
| 188 | * initialize the cache. We do the work to free tree members | 187 | * initialize the cache. We do the work to free tree members |
| @@ -249,10 +248,10 @@ static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci, | |||
| 249 | 248 | ||
| 250 | ocfs2_metadata_cache_lock(ci); | 249 | ocfs2_metadata_cache_lock(ci); |
| 251 | 250 | ||
| 252 | mlog(0, "Owner %llu, query block %llu (inline = %u)\n", | 251 | trace_ocfs2_buffer_cached_begin( |
| 253 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 252 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 254 | (unsigned long long) bh->b_blocknr, | 253 | (unsigned long long) bh->b_blocknr, |
| 255 | !!(ci->ci_flags & OCFS2_CACHE_FL_INLINE)); | 254 | !!(ci->ci_flags & OCFS2_CACHE_FL_INLINE)); |
| 256 | 255 | ||
| 257 | if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) | 256 | if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) |
| 258 | index = ocfs2_search_cache_array(ci, bh->b_blocknr); | 257 | index = ocfs2_search_cache_array(ci, bh->b_blocknr); |
| @@ -261,7 +260,7 @@ static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci, | |||
| 261 | 260 | ||
| 262 | ocfs2_metadata_cache_unlock(ci); | 261 | ocfs2_metadata_cache_unlock(ci); |
| 263 | 262 | ||
| 264 | mlog(0, "index = %d, item = %p\n", index, item); | 263 | trace_ocfs2_buffer_cached_end(index, item); |
| 265 | 264 | ||
| 266 | return (index != -1) || (item != NULL); | 265 | return (index != -1) || (item != NULL); |
| 267 | } | 266 | } |
| @@ -306,8 +305,9 @@ static void ocfs2_append_cache_array(struct ocfs2_caching_info *ci, | |||
| 306 | { | 305 | { |
| 307 | BUG_ON(ci->ci_num_cached >= OCFS2_CACHE_INFO_MAX_ARRAY); | 306 | BUG_ON(ci->ci_num_cached >= OCFS2_CACHE_INFO_MAX_ARRAY); |
| 308 | 307 | ||
| 309 | mlog(0, "block %llu takes position %u\n", (unsigned long long) block, | 308 | trace_ocfs2_append_cache_array( |
| 310 | ci->ci_num_cached); | 309 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 310 | (unsigned long long)block, ci->ci_num_cached); | ||
| 311 | 311 | ||
| 312 | ci->ci_cache.ci_array[ci->ci_num_cached] = block; | 312 | ci->ci_cache.ci_array[ci->ci_num_cached] = block; |
| 313 | ci->ci_num_cached++; | 313 | ci->ci_num_cached++; |
| @@ -324,8 +324,9 @@ static void __ocfs2_insert_cache_tree(struct ocfs2_caching_info *ci, | |||
| 324 | struct rb_node **p = &ci->ci_cache.ci_tree.rb_node; | 324 | struct rb_node **p = &ci->ci_cache.ci_tree.rb_node; |
| 325 | struct ocfs2_meta_cache_item *tmp; | 325 | struct ocfs2_meta_cache_item *tmp; |
| 326 | 326 | ||
| 327 | mlog(0, "Insert block %llu num = %u\n", (unsigned long long) block, | 327 | trace_ocfs2_insert_cache_tree( |
| 328 | ci->ci_num_cached); | 328 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 329 | (unsigned long long)block, ci->ci_num_cached); | ||
| 329 | 330 | ||
| 330 | while(*p) { | 331 | while(*p) { |
| 331 | parent = *p; | 332 | parent = *p; |
| @@ -389,9 +390,9 @@ static void ocfs2_expand_cache(struct ocfs2_caching_info *ci, | |||
| 389 | tree[i] = NULL; | 390 | tree[i] = NULL; |
| 390 | } | 391 | } |
| 391 | 392 | ||
| 392 | mlog(0, "Expanded %llu to a tree cache: flags 0x%x, num = %u\n", | 393 | trace_ocfs2_expand_cache( |
| 393 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 394 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 394 | ci->ci_flags, ci->ci_num_cached); | 395 | ci->ci_flags, ci->ci_num_cached); |
| 395 | } | 396 | } |
| 396 | 397 | ||
| 397 | /* Slow path function - memory allocation is necessary. See the | 398 | /* Slow path function - memory allocation is necessary. See the |
| @@ -405,9 +406,9 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci, | |||
| 405 | struct ocfs2_meta_cache_item *tree[OCFS2_CACHE_INFO_MAX_ARRAY] = | 406 | struct ocfs2_meta_cache_item *tree[OCFS2_CACHE_INFO_MAX_ARRAY] = |
| 406 | { NULL, }; | 407 | { NULL, }; |
| 407 | 408 | ||
| 408 | mlog(0, "Owner %llu, block %llu, expand = %d\n", | 409 | trace_ocfs2_set_buffer_uptodate( |
| 409 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 410 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 410 | (unsigned long long)block, expand_tree); | 411 | (unsigned long long)block, expand_tree); |
| 411 | 412 | ||
| 412 | new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_NOFS); | 413 | new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_NOFS); |
| 413 | if (!new) { | 414 | if (!new) { |
| @@ -433,7 +434,6 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci, | |||
| 433 | 434 | ||
| 434 | ocfs2_metadata_cache_lock(ci); | 435 | ocfs2_metadata_cache_lock(ci); |
| 435 | if (ocfs2_insert_can_use_array(ci)) { | 436 | if (ocfs2_insert_can_use_array(ci)) { |
| 436 | mlog(0, "Someone cleared the tree underneath us\n"); | ||
| 437 | /* Ok, items were removed from the cache in between | 437 | /* Ok, items were removed from the cache in between |
| 438 | * locks. Detect this and revert back to the fast path */ | 438 | * locks. Detect this and revert back to the fast path */ |
| 439 | ocfs2_append_cache_array(ci, block); | 439 | ocfs2_append_cache_array(ci, block); |
| @@ -490,9 +490,9 @@ void ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci, | |||
| 490 | if (ocfs2_buffer_cached(ci, bh)) | 490 | if (ocfs2_buffer_cached(ci, bh)) |
| 491 | return; | 491 | return; |
| 492 | 492 | ||
| 493 | mlog(0, "Owner %llu, inserting block %llu\n", | 493 | trace_ocfs2_set_buffer_uptodate_begin( |
| 494 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 494 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 495 | (unsigned long long)bh->b_blocknr); | 495 | (unsigned long long)bh->b_blocknr); |
| 496 | 496 | ||
| 497 | /* No need to recheck under spinlock - insertion is guarded by | 497 | /* No need to recheck under spinlock - insertion is guarded by |
| 498 | * co_io_lock() */ | 498 | * co_io_lock() */ |
| @@ -542,8 +542,9 @@ static void ocfs2_remove_metadata_array(struct ocfs2_caching_info *ci, | |||
| 542 | BUG_ON(index >= ci->ci_num_cached); | 542 | BUG_ON(index >= ci->ci_num_cached); |
| 543 | BUG_ON(!ci->ci_num_cached); | 543 | BUG_ON(!ci->ci_num_cached); |
| 544 | 544 | ||
| 545 | mlog(0, "remove index %d (num_cached = %u\n", index, | 545 | trace_ocfs2_remove_metadata_array( |
| 546 | ci->ci_num_cached); | 546 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 547 | index, ci->ci_num_cached); | ||
| 547 | 548 | ||
| 548 | ci->ci_num_cached--; | 549 | ci->ci_num_cached--; |
| 549 | 550 | ||
| @@ -559,8 +560,9 @@ static void ocfs2_remove_metadata_array(struct ocfs2_caching_info *ci, | |||
| 559 | static void ocfs2_remove_metadata_tree(struct ocfs2_caching_info *ci, | 560 | static void ocfs2_remove_metadata_tree(struct ocfs2_caching_info *ci, |
| 560 | struct ocfs2_meta_cache_item *item) | 561 | struct ocfs2_meta_cache_item *item) |
| 561 | { | 562 | { |
| 562 | mlog(0, "remove block %llu from tree\n", | 563 | trace_ocfs2_remove_metadata_tree( |
| 563 | (unsigned long long) item->c_block); | 564 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 565 | (unsigned long long)item->c_block); | ||
| 564 | 566 | ||
| 565 | rb_erase(&item->c_node, &ci->ci_cache.ci_tree); | 567 | rb_erase(&item->c_node, &ci->ci_cache.ci_tree); |
| 566 | ci->ci_num_cached--; | 568 | ci->ci_num_cached--; |
| @@ -573,10 +575,10 @@ static void ocfs2_remove_block_from_cache(struct ocfs2_caching_info *ci, | |||
| 573 | struct ocfs2_meta_cache_item *item = NULL; | 575 | struct ocfs2_meta_cache_item *item = NULL; |
| 574 | 576 | ||
| 575 | ocfs2_metadata_cache_lock(ci); | 577 | ocfs2_metadata_cache_lock(ci); |
| 576 | mlog(0, "Owner %llu, remove %llu, items = %u, array = %u\n", | 578 | trace_ocfs2_remove_block_from_cache( |
| 577 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 579 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
| 578 | (unsigned long long) block, ci->ci_num_cached, | 580 | (unsigned long long) block, ci->ci_num_cached, |
| 579 | ci->ci_flags & OCFS2_CACHE_FL_INLINE); | 581 | ci->ci_flags); |
| 580 | 582 | ||
| 581 | if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) { | 583 | if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) { |
| 582 | index = ocfs2_search_cache_array(ci, block); | 584 | index = ocfs2_search_cache_array(ci, block); |
| @@ -626,9 +628,6 @@ int __init init_ocfs2_uptodate_cache(void) | |||
| 626 | if (!ocfs2_uptodate_cachep) | 628 | if (!ocfs2_uptodate_cachep) |
| 627 | return -ENOMEM; | 629 | return -ENOMEM; |
| 628 | 630 | ||
| 629 | mlog(0, "%u inlined cache items per inode.\n", | ||
| 630 | OCFS2_CACHE_INFO_MAX_ARRAY); | ||
| 631 | |||
| 632 | return 0; | 631 | return 0; |
| 633 | } | 632 | } |
| 634 | 633 | ||
