aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/alloc.c165
-rw-r--r--fs/ocfs2/ocfs2_trace.h364
2 files changed, 452 insertions, 77 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 80ffbe3dd32f..f0e26c4adc94 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -50,6 +50,7 @@
50#include "uptodate.h" 50#include "uptodate.h"
51#include "xattr.h" 51#include "xattr.h"
52#include "refcounttree.h" 52#include "refcounttree.h"
53#include "ocfs2_trace.h"
53 54
54#include "buffer_head_io.h" 55#include "buffer_head_io.h"
55 56
@@ -886,8 +887,7 @@ static int ocfs2_validate_extent_block(struct super_block *sb,
886 struct ocfs2_extent_block *eb = 887 struct ocfs2_extent_block *eb =
887 (struct ocfs2_extent_block *)bh->b_data; 888 (struct ocfs2_extent_block *)bh->b_data;
888 889
889 mlog(0, "Validating extent block %llu\n", 890 trace_ocfs2_validate_extent_block((unsigned long long)bh->b_blocknr);
890 (unsigned long long)bh->b_blocknr);
891 891
892 BUG_ON(!buffer_uptodate(bh)); 892 BUG_ON(!buffer_uptodate(bh));
893 893
@@ -985,7 +985,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb,
985bail: 985bail:
986 brelse(eb_bh); 986 brelse(eb_bh);
987 987
988 mlog(0, "retval = %d\n", retval); 988 trace_ocfs2_num_free_extents(retval);
989 return retval; 989 return retval;
990} 990}
991 991
@@ -1194,8 +1194,11 @@ static int ocfs2_add_branch(handle_t *handle,
1194 * from new_cpos). 1194 * from new_cpos).
1195 */ 1195 */
1196 if (root_end > new_cpos) { 1196 if (root_end > new_cpos) {
1197 mlog(0, "adjust the cluster end from %u to %u\n", 1197 trace_ocfs2_adjust_rightmost_branch(
1198 root_end, new_cpos); 1198 (unsigned long long)
1199 ocfs2_metadata_cache_owner(et->et_ci),
1200 root_end, new_cpos);
1201
1199 status = ocfs2_adjust_rightmost_branch(handle, et); 1202 status = ocfs2_adjust_rightmost_branch(handle, et);
1200 if (status) { 1203 if (status) {
1201 mlog_errno(status); 1204 mlog_errno(status);
@@ -1527,7 +1530,10 @@ static int ocfs2_grow_tree(handle_t *handle, struct ocfs2_extent_tree *et,
1527 * another tree level */ 1530 * another tree level */
1528 if (shift) { 1531 if (shift) {
1529 BUG_ON(bh); 1532 BUG_ON(bh);
1530 mlog(0, "need to shift tree depth (current = %d)\n", depth); 1533 trace_ocfs2_grow_tree(
1534 (unsigned long long)
1535 ocfs2_metadata_cache_owner(et->et_ci),
1536 depth);
1531 1537
1532 /* ocfs2_shift_tree_depth will return us a buffer with 1538 /* ocfs2_shift_tree_depth will return us a buffer with
1533 * the new extent block (so we can pass that to 1539 * the new extent block (so we can pass that to
@@ -1557,7 +1563,6 @@ static int ocfs2_grow_tree(handle_t *handle, struct ocfs2_extent_tree *et,
1557 1563
1558 /* call ocfs2_add_branch to add the final part of the tree with 1564 /* call ocfs2_add_branch to add the final part of the tree with
1559 * the new data. */ 1565 * the new data. */
1560 mlog(0, "add branch. bh = %p\n", bh);
1561 ret = ocfs2_add_branch(handle, et, bh, last_eb_bh, 1566 ret = ocfs2_add_branch(handle, et, bh, last_eb_bh,
1562 meta_ac); 1567 meta_ac);
1563 if (ret < 0) { 1568 if (ret < 0) {
@@ -1632,8 +1637,9 @@ static void ocfs2_rotate_leaf(struct ocfs2_extent_list *el,
1632 } 1637 }
1633 insert_index = i; 1638 insert_index = i;
1634 1639
1635 mlog(0, "ins %u: index %d, has_empty %d, next_free %d, count %d\n", 1640 trace_ocfs2_rotate_leaf(insert_cpos, insert_index,
1636 insert_cpos, insert_index, has_empty, next_free, le16_to_cpu(el->l_count)); 1641 has_empty, next_free,
1642 le16_to_cpu(el->l_count));
1637 1643
1638 BUG_ON(insert_index < 0); 1644 BUG_ON(insert_index < 0);
1639 BUG_ON(insert_index >= le16_to_cpu(el->l_count)); 1645 BUG_ON(insert_index >= le16_to_cpu(el->l_count));
@@ -2046,7 +2052,7 @@ static void ocfs2_complete_edge_insert(handle_t *handle,
2046 left_el = path_leaf_el(left_path); 2052 left_el = path_leaf_el(left_path);
2047 right_el = path_leaf_el(right_path); 2053 right_el = path_leaf_el(right_path);
2048 for(i = left_path->p_tree_depth - 1; i > subtree_index; i--) { 2054 for(i = left_path->p_tree_depth - 1; i > subtree_index; i--) {
2049 mlog(0, "Adjust records at index %u\n", i); 2055 trace_ocfs2_complete_edge_insert(i);
2050 2056
2051 /* 2057 /*
2052 * One nice property of knowing that all of these 2058 * One nice property of knowing that all of these
@@ -2376,7 +2382,9 @@ static int ocfs2_rotate_tree_right(handle_t *handle,
2376 goto out; 2382 goto out;
2377 } 2383 }
2378 2384
2379 mlog(0, "Insert: %u, first left path cpos: %u\n", insert_cpos, cpos); 2385 trace_ocfs2_rotate_tree_right(
2386 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
2387 insert_cpos, cpos);
2380 2388
2381 /* 2389 /*
2382 * What we want to do here is: 2390 * What we want to do here is:
@@ -2405,8 +2413,10 @@ static int ocfs2_rotate_tree_right(handle_t *handle,
2405 * rotating subtrees. 2413 * rotating subtrees.
2406 */ 2414 */
2407 while (cpos && insert_cpos <= cpos) { 2415 while (cpos && insert_cpos <= cpos) {
2408 mlog(0, "Rotating a tree: ins. cpos: %u, left path cpos: %u\n", 2416 trace_ocfs2_rotate_tree_right(
2409 insert_cpos, cpos); 2417 (unsigned long long)
2418 ocfs2_metadata_cache_owner(et->et_ci),
2419 insert_cpos, cpos);
2410 2420
2411 ret = ocfs2_find_path(et->et_ci, left_path, cpos); 2421 ret = ocfs2_find_path(et->et_ci, left_path, cpos);
2412 if (ret) { 2422 if (ret) {
@@ -2448,10 +2458,10 @@ static int ocfs2_rotate_tree_right(handle_t *handle,
2448 2458
2449 start = ocfs2_find_subtree_root(et, left_path, right_path); 2459 start = ocfs2_find_subtree_root(et, left_path, right_path);
2450 2460
2451 mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n", 2461 trace_ocfs2_rotate_subtree(start,
2452 start, 2462 (unsigned long long)
2453 (unsigned long long) right_path->p_node[start].bh->b_blocknr, 2463 right_path->p_node[start].bh->b_blocknr,
2454 right_path->p_tree_depth); 2464 right_path->p_tree_depth);
2455 2465
2456 ret = ocfs2_extend_rotate_transaction(handle, start, 2466 ret = ocfs2_extend_rotate_transaction(handle, start,
2457 orig_credits, right_path); 2467 orig_credits, right_path);
@@ -2951,8 +2961,7 @@ static int __ocfs2_rotate_tree_left(handle_t *handle,
2951 subtree_root = ocfs2_find_subtree_root(et, left_path, 2961 subtree_root = ocfs2_find_subtree_root(et, left_path,
2952 right_path); 2962 right_path);
2953 2963
2954 mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n", 2964 trace_ocfs2_rotate_subtree(subtree_root,
2955 subtree_root,
2956 (unsigned long long) 2965 (unsigned long long)
2957 right_path->p_node[subtree_root].bh->b_blocknr, 2966 right_path->p_node[subtree_root].bh->b_blocknr,
2958 right_path->p_tree_depth); 2967 right_path->p_tree_depth);
@@ -3976,9 +3985,11 @@ static int ocfs2_append_rec_to_path(handle_t *handle,
3976 goto out; 3985 goto out;
3977 } 3986 }
3978 3987
3979 mlog(0, "Append may need a left path update. cpos: %u, " 3988 trace_ocfs2_append_rec_to_path(
3980 "left_cpos: %u\n", le32_to_cpu(insert_rec->e_cpos), 3989 (unsigned long long)
3981 left_cpos); 3990 ocfs2_metadata_cache_owner(et->et_ci),
3991 le32_to_cpu(insert_rec->e_cpos),
3992 left_cpos);
3982 3993
3983 /* 3994 /*
3984 * No need to worry if the append is already in the 3995 * No need to worry if the append is already in the
@@ -4665,9 +4676,9 @@ int ocfs2_insert_extent(handle_t *handle,
4665 struct ocfs2_insert_type insert = {0, }; 4676 struct ocfs2_insert_type insert = {0, };
4666 struct ocfs2_extent_rec rec; 4677 struct ocfs2_extent_rec rec;
4667 4678
4668 mlog(0, "add %u clusters at position %u to owner %llu\n", 4679 trace_ocfs2_insert_extent_start(
4669 new_clusters, cpos, 4680 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
4670 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci)); 4681 cpos, new_clusters);
4671 4682
4672 memset(&rec, 0, sizeof(rec)); 4683 memset(&rec, 0, sizeof(rec));
4673 rec.e_cpos = cpu_to_le32(cpos); 4684 rec.e_cpos = cpu_to_le32(cpos);
@@ -4687,11 +4698,9 @@ int ocfs2_insert_extent(handle_t *handle,
4687 goto bail; 4698 goto bail;
4688 } 4699 }
4689 4700
4690 mlog(0, "Insert.appending: %u, Insert.Contig: %u, " 4701 trace_ocfs2_insert_extent(insert.ins_appending, insert.ins_contig,
4691 "Insert.contig_index: %d, Insert.free_records: %d, " 4702 insert.ins_contig_index, free_records,
4692 "Insert.tree_depth: %d\n", 4703 insert.ins_tree_depth);
4693 insert.ins_appending, insert.ins_contig, insert.ins_contig_index,
4694 free_records, insert.ins_tree_depth);
4695 4704
4696 if (insert.ins_contig == CONTIG_NONE && free_records == 0) { 4705 if (insert.ins_contig == CONTIG_NONE && free_records == 0) {
4697 status = ocfs2_grow_tree(handle, et, 4706 status = ocfs2_grow_tree(handle, et,
@@ -4732,7 +4741,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
4732 struct ocfs2_alloc_context *meta_ac, 4741 struct ocfs2_alloc_context *meta_ac,
4733 enum ocfs2_alloc_restarted *reason_ret) 4742 enum ocfs2_alloc_restarted *reason_ret)
4734{ 4743{
4735 int status = 0; 4744 int status = 0, err = 0;
4736 int free_extents; 4745 int free_extents;
4737 enum ocfs2_alloc_restarted reason = RESTART_NONE; 4746 enum ocfs2_alloc_restarted reason = RESTART_NONE;
4738 u32 bit_off, num_bits; 4747 u32 bit_off, num_bits;
@@ -4759,14 +4768,14 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
4759 * 2) we are so fragmented, we've needed to add metadata too 4768 * 2) we are so fragmented, we've needed to add metadata too
4760 * many times. */ 4769 * many times. */
4761 if (!free_extents && !meta_ac) { 4770 if (!free_extents && !meta_ac) {
4762 mlog(0, "we haven't reserved any metadata!\n"); 4771 err = -1;
4763 status = -EAGAIN; 4772 status = -EAGAIN;
4764 reason = RESTART_META; 4773 reason = RESTART_META;
4765 goto leave; 4774 goto leave;
4766 } else if ((!free_extents) 4775 } else if ((!free_extents)
4767 && (ocfs2_alloc_context_bits_left(meta_ac) 4776 && (ocfs2_alloc_context_bits_left(meta_ac)
4768 < ocfs2_extend_meta_needed(et->et_root_el))) { 4777 < ocfs2_extend_meta_needed(et->et_root_el))) {
4769 mlog(0, "filesystem is really fragmented...\n"); 4778 err = -2;
4770 status = -EAGAIN; 4779 status = -EAGAIN;
4771 reason = RESTART_META; 4780 reason = RESTART_META;
4772 goto leave; 4781 goto leave;
@@ -4791,9 +4800,9 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
4791 } 4800 }
4792 4801
4793 block = ocfs2_clusters_to_blocks(osb->sb, bit_off); 4802 block = ocfs2_clusters_to_blocks(osb->sb, bit_off);
4794 mlog(0, "Allocating %u clusters at block %u for owner %llu\n", 4803 trace_ocfs2_add_clusters_in_btree(
4795 num_bits, bit_off, 4804 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
4796 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci)); 4805 bit_off, num_bits);
4797 status = ocfs2_insert_extent(handle, et, *logical_offset, block, 4806 status = ocfs2_insert_extent(handle, et, *logical_offset, block,
4798 num_bits, flags, meta_ac); 4807 num_bits, flags, meta_ac);
4799 if (status < 0) { 4808 if (status < 0) {
@@ -4807,8 +4816,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
4807 *logical_offset += num_bits; 4816 *logical_offset += num_bits;
4808 4817
4809 if (clusters_to_add) { 4818 if (clusters_to_add) {
4810 mlog(0, "need to alloc once more, wanted = %u\n", 4819 err = clusters_to_add;
4811 clusters_to_add);
4812 status = -EAGAIN; 4820 status = -EAGAIN;
4813 reason = RESTART_TRANS; 4821 reason = RESTART_TRANS;
4814 } 4822 }
@@ -4816,6 +4824,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
4816leave: 4824leave:
4817 if (reason_ret) 4825 if (reason_ret)
4818 *reason_ret = reason; 4826 *reason_ret = reason;
4827 trace_ocfs2_add_clusters_in_btree_ret(status, reason, err);
4819 return status; 4828 return status;
4820} 4829}
4821 4830
@@ -5041,9 +5050,9 @@ int ocfs2_split_extent(handle_t *handle,
5041 5050
5042 ctxt.c_has_empty_extent = ocfs2_is_empty_extent(&el->l_recs[0]); 5051 ctxt.c_has_empty_extent = ocfs2_is_empty_extent(&el->l_recs[0]);
5043 5052
5044 mlog(0, "index: %d, contig: %u, has_empty: %u, split_covers: %u\n", 5053 trace_ocfs2_split_extent(split_index, ctxt.c_contig_type,
5045 split_index, ctxt.c_contig_type, ctxt.c_has_empty_extent, 5054 ctxt.c_has_empty_extent,
5046 ctxt.c_split_covers_rec); 5055 ctxt.c_split_covers_rec);
5047 5056
5048 if (ctxt.c_contig_type == CONTIG_NONE) { 5057 if (ctxt.c_contig_type == CONTIG_NONE) {
5049 if (ctxt.c_split_covers_rec) 5058 if (ctxt.c_split_covers_rec)
@@ -5177,8 +5186,9 @@ int ocfs2_mark_extent_written(struct inode *inode,
5177{ 5186{
5178 int ret; 5187 int ret;
5179 5188
5180 mlog(0, "Inode %lu cpos %u, len %u, phys clusters %u\n", 5189 trace_ocfs2_mark_extent_written(
5181 inode->i_ino, cpos, len, phys); 5190 (unsigned long long)OCFS2_I(inode)->ip_blkno,
5191 cpos, len, phys);
5182 5192
5183 if (!ocfs2_writes_unwritten_extents(OCFS2_SB(inode->i_sb))) { 5193 if (!ocfs2_writes_unwritten_extents(OCFS2_SB(inode->i_sb))) {
5184 ocfs2_error(inode->i_sb, "Inode %llu has unwritten extents " 5194 ocfs2_error(inode->i_sb, "Inode %llu has unwritten extents "
@@ -5497,11 +5507,10 @@ int ocfs2_remove_extent(handle_t *handle,
5497 5507
5498 BUG_ON(cpos < le32_to_cpu(rec->e_cpos) || trunc_range > rec_range); 5508 BUG_ON(cpos < le32_to_cpu(rec->e_cpos) || trunc_range > rec_range);
5499 5509
5500 mlog(0, "Owner %llu, remove (cpos %u, len %u). Existing index %d " 5510 trace_ocfs2_remove_extent(
5501 "(cpos %u, len %u)\n", 5511 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci),
5502 (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci), 5512 cpos, len, index, le32_to_cpu(rec->e_cpos),
5503 cpos, len, index, 5513 ocfs2_rec_clusters(el, rec));
5504 le32_to_cpu(rec->e_cpos), ocfs2_rec_clusters(el, rec));
5505 5514
5506 if (le32_to_cpu(rec->e_cpos) == cpos || rec_range == trunc_range) { 5515 if (le32_to_cpu(rec->e_cpos) == cpos || rec_range == trunc_range) {
5507 ret = ocfs2_truncate_rec(handle, et, path, index, dealloc, 5516 ret = ocfs2_truncate_rec(handle, et, path, index, dealloc,
@@ -5780,9 +5789,6 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
5780 struct ocfs2_dinode *di; 5789 struct ocfs2_dinode *di;
5781 struct ocfs2_truncate_log *tl; 5790 struct ocfs2_truncate_log *tl;
5782 5791
5783 mlog(0, "start_blk = %llu, num_clusters = %u\n",
5784 (unsigned long long)start_blk, num_clusters);
5785
5786 BUG_ON(mutex_trylock(&tl_inode->i_mutex)); 5792 BUG_ON(mutex_trylock(&tl_inode->i_mutex));
5787 5793
5788 start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk); 5794 start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk);
@@ -5819,10 +5825,9 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
5819 goto bail; 5825 goto bail;
5820 } 5826 }
5821 5827
5822 mlog(0, "Log truncate of %u clusters starting at cluster %u to " 5828 trace_ocfs2_truncate_log_append(
5823 "%llu (index = %d)\n", num_clusters, start_cluster, 5829 (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, index,
5824 (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, index); 5830 start_cluster, num_clusters);
5825
5826 if (ocfs2_truncate_log_can_coalesce(tl, start_cluster)) { 5831 if (ocfs2_truncate_log_can_coalesce(tl, start_cluster)) {
5827 /* 5832 /*
5828 * Move index back to the record we are coalescing with. 5833 * Move index back to the record we are coalescing with.
@@ -5831,9 +5836,10 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
5831 index--; 5836 index--;
5832 5837
5833 num_clusters += le32_to_cpu(tl->tl_recs[index].t_clusters); 5838 num_clusters += le32_to_cpu(tl->tl_recs[index].t_clusters);
5834 mlog(0, "Coalesce with index %u (start = %u, clusters = %u)\n", 5839 trace_ocfs2_truncate_log_append(
5835 index, le32_to_cpu(tl->tl_recs[index].t_start), 5840 (unsigned long long)OCFS2_I(tl_inode)->ip_blkno,
5836 num_clusters); 5841 index, le32_to_cpu(tl->tl_recs[index].t_start),
5842 num_clusters);
5837 } else { 5843 } else {
5838 tl->tl_recs[index].t_start = cpu_to_le32(start_cluster); 5844 tl->tl_recs[index].t_start = cpu_to_le32(start_cluster);
5839 tl->tl_used = cpu_to_le16(index + 1); 5845 tl->tl_used = cpu_to_le16(index + 1);
@@ -5897,8 +5903,9 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
5897 /* if start_blk is not set, we ignore the record as 5903 /* if start_blk is not set, we ignore the record as
5898 * invalid. */ 5904 * invalid. */
5899 if (start_blk) { 5905 if (start_blk) {
5900 mlog(0, "free record %d, start = %u, clusters = %u\n", 5906 trace_ocfs2_replay_truncate_records(
5901 i, le32_to_cpu(rec.t_start), num_clusters); 5907 (unsigned long long)OCFS2_I(tl_inode)->ip_blkno,
5908 i, le32_to_cpu(rec.t_start), num_clusters);
5902 5909
5903 status = ocfs2_free_clusters(handle, data_alloc_inode, 5910 status = ocfs2_free_clusters(handle, data_alloc_inode,
5904 data_alloc_bh, start_blk, 5911 data_alloc_bh, start_blk,
@@ -5941,8 +5948,9 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
5941 5948
5942 tl = &di->id2.i_dealloc; 5949 tl = &di->id2.i_dealloc;
5943 num_to_flush = le16_to_cpu(tl->tl_used); 5950 num_to_flush = le16_to_cpu(tl->tl_used);
5944 mlog(0, "Flush %u records from truncate log #%llu\n", 5951 trace_ocfs2_flush_truncate_log(
5945 num_to_flush, (unsigned long long)OCFS2_I(tl_inode)->ip_blkno); 5952 (unsigned long long)OCFS2_I(tl_inode)->ip_blkno,
5953 num_to_flush);
5946 if (!num_to_flush) { 5954 if (!num_to_flush) {
5947 status = 0; 5955 status = 0;
5948 goto out; 5956 goto out;
@@ -6079,7 +6087,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
6079 6087
6080 *tl_copy = NULL; 6088 *tl_copy = NULL;
6081 6089
6082 mlog(0, "recover truncate log from slot %d\n", slot_num); 6090 trace_ocfs2_begin_truncate_log_recovery(slot_num);
6083 6091
6084 status = ocfs2_get_truncate_log_info(osb, slot_num, &tl_inode, &tl_bh); 6092 status = ocfs2_get_truncate_log_info(osb, slot_num, &tl_inode, &tl_bh);
6085 if (status < 0) { 6093 if (status < 0) {
@@ -6096,8 +6104,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
6096 6104
6097 tl = &di->id2.i_dealloc; 6105 tl = &di->id2.i_dealloc;
6098 if (le16_to_cpu(tl->tl_used)) { 6106 if (le16_to_cpu(tl->tl_used)) {
6099 mlog(0, "We'll have %u logs to recover\n", 6107 trace_ocfs2_truncate_log_recovery_num(le16_to_cpu(tl->tl_used));
6100 le16_to_cpu(tl->tl_used));
6101 6108
6102 *tl_copy = kmalloc(tl_bh->b_size, GFP_KERNEL); 6109 *tl_copy = kmalloc(tl_bh->b_size, GFP_KERNEL);
6103 if (!(*tl_copy)) { 6110 if (!(*tl_copy)) {
@@ -6154,8 +6161,9 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
6154 6161
6155 tl = &tl_copy->id2.i_dealloc; 6162 tl = &tl_copy->id2.i_dealloc;
6156 num_recs = le16_to_cpu(tl->tl_used); 6163 num_recs = le16_to_cpu(tl->tl_used);
6157 mlog(0, "cleanup %u records from %llu\n", num_recs, 6164 trace_ocfs2_complete_truncate_log_recovery(
6158 (unsigned long long)le64_to_cpu(tl_copy->i_blkno)); 6165 (unsigned long long)le64_to_cpu(tl_copy->i_blkno),
6166 num_recs);
6159 6167
6160 mutex_lock(&tl_inode->i_mutex); 6168 mutex_lock(&tl_inode->i_mutex);
6161 for(i = 0; i < num_recs; i++) { 6169 for(i = 0; i < num_recs; i++) {
@@ -6313,8 +6321,8 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb,
6313 else 6321 else
6314 bg_blkno = ocfs2_which_suballoc_group(head->free_blk, 6322 bg_blkno = ocfs2_which_suballoc_group(head->free_blk,
6315 head->free_bit); 6323 head->free_bit);
6316 mlog(0, "Free bit: (bit %u, blkno %llu)\n", 6324 trace_ocfs2_free_cached_blocks(
6317 head->free_bit, (unsigned long long)head->free_blk); 6325 (unsigned long long)head->free_blk, head->free_bit);
6318 6326
6319 ret = ocfs2_free_suballoc_bits(handle, inode, di_bh, 6327 ret = ocfs2_free_suballoc_bits(handle, inode, di_bh,
6320 head->free_bit, bg_blkno, 1); 6328 head->free_bit, bg_blkno, 1);
@@ -6367,8 +6375,7 @@ int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
6367 return ret; 6375 return ret;
6368 } 6376 }
6369 6377
6370 mlog(0, "Insert clusters: (bit %u, blk %llu)\n", 6378 trace_ocfs2_cache_cluster_dealloc((unsigned long long)blkno, bit);
6371 bit, (unsigned long long)blkno);
6372 6379
6373 item->free_blk = blkno; 6380 item->free_blk = blkno;
6374 item->free_bit = bit; 6381 item->free_bit = bit;
@@ -6443,8 +6450,8 @@ int ocfs2_run_deallocs(struct ocfs2_super *osb,
6443 fl = ctxt->c_first_suballocator; 6450 fl = ctxt->c_first_suballocator;
6444 6451
6445 if (fl->f_first) { 6452 if (fl->f_first) {
6446 mlog(0, "Free items: (type %u, slot %d)\n", 6453 trace_ocfs2_run_deallocs(fl->f_inode_type,
6447 fl->f_inode_type, fl->f_slot); 6454 fl->f_slot);
6448 ret2 = ocfs2_free_cached_blocks(osb, 6455 ret2 = ocfs2_free_cached_blocks(osb,
6449 fl->f_inode_type, 6456 fl->f_inode_type,
6450 fl->f_slot, 6457 fl->f_slot,
@@ -6521,8 +6528,9 @@ int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
6521 goto out; 6528 goto out;
6522 } 6529 }
6523 6530
6524 mlog(0, "Insert: (type %d, slot %u, bit %u, blk %llu)\n", 6531 trace_ocfs2_cache_block_dealloc(type, slot,
6525 type, slot, bit, (unsigned long long)blkno); 6532 (unsigned long long)suballoc,
6533 (unsigned long long)blkno, bit);
6526 6534
6527 item->free_bg = suballoc; 6535 item->free_bg = suballoc;
6528 item->free_blk = blkno; 6536 item->free_blk = blkno;
@@ -7002,8 +7010,11 @@ start:
7002 goto bail; 7010 goto bail;
7003 } 7011 }
7004 7012
7005 mlog(0, "inode->ip_clusters = %u, tree_depth = %u\n", 7013 trace_ocfs2_commit_truncate(
7006 OCFS2_I(inode)->ip_clusters, path->p_tree_depth); 7014 (unsigned long long)OCFS2_I(inode)->ip_blkno,
7015 new_highest_cpos,
7016 OCFS2_I(inode)->ip_clusters,
7017 path->p_tree_depth);
7007 7018
7008 /* 7019 /*
7009 * By now, el will point to the extent list on the bottom most 7020 * By now, el will point to the extent list on the bottom most
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h
index 8d4e49aef491..1793b1f71805 100644
--- a/fs/ocfs2/ocfs2_trace.h
+++ b/fs/ocfs2/ocfs2_trace.h
@@ -6,6 +6,370 @@
6 6
7#include <linux/tracepoint.h> 7#include <linux/tracepoint.h>
8 8
9DECLARE_EVENT_CLASS(ocfs2__int,
10 TP_PROTO(int num),
11 TP_ARGS(num),
12 TP_STRUCT__entry(
13 __field(int, num)
14 ),
15 TP_fast_assign(
16 __entry->num = num;
17 ),
18 TP_printk("%d", __entry->num)
19);
20
21#define DEFINE_OCFS2_INT_EVENT(name) \
22DEFINE_EVENT(ocfs2__int, name, \
23 TP_PROTO(int num), \
24 TP_ARGS(num))
25
26DECLARE_EVENT_CLASS(ocfs2__int_int,
27 TP_PROTO(int value1, int value2),
28 TP_ARGS(value1, value2),
29 TP_STRUCT__entry(
30 __field(int, value1)
31 __field(int, value2)
32 ),
33 TP_fast_assign(
34 __entry->value1 = value1;
35 __entry->value2 = value2;
36 ),
37 TP_printk("%d %d", __entry->value1, __entry->value2)
38);
39
40#define DEFINE_OCFS2_INT_INT_EVENT(name) \
41DEFINE_EVENT(ocfs2__int_int, name, \
42 TP_PROTO(int val1, int val2), \
43 TP_ARGS(val1, val2))
44
45DECLARE_EVENT_CLASS(ocfs2__ull_uint,
46 TP_PROTO(unsigned long long value1, unsigned int value2),
47 TP_ARGS(value1, value2),
48 TP_STRUCT__entry(
49 __field(unsigned long long, value1)
50 __field(unsigned int, value2)
51 ),
52 TP_fast_assign(
53 __entry->value1 = value1;
54 __entry->value2 = value2;
55 ),
56 TP_printk("%llu %u", __entry->value1, __entry->value2)
57);
58
59#define DEFINE_OCFS2_ULL_UINT_EVENT(name) \
60DEFINE_EVENT(ocfs2__ull_uint, name, \
61 TP_PROTO(unsigned long long val1, unsigned int val2), \
62 TP_ARGS(val1, val2))
63
64/* Trace events for fs/ocfs2/alloc.c. */
65DECLARE_EVENT_CLASS(ocfs2__btree_ops,
66 TP_PROTO(unsigned long long owner,\
67 unsigned int value1, unsigned int value2),
68 TP_ARGS(owner, value1, value2),
69 TP_STRUCT__entry(
70 __field(unsigned long long, owner)
71 __field(unsigned int, value1)
72 __field(unsigned int, value2)
73 ),
74 TP_fast_assign(
75 __entry->owner = owner;
76 __entry->value1 = value1;
77 __entry->value2 = value2;
78 ),
79 TP_printk("%llu %u %u",
80 __entry->owner, __entry->value1, __entry->value2)
81);
82
83#define DEFINE_OCFS2_BTREE_EVENT(name) \
84DEFINE_EVENT(ocfs2__btree_ops, name, \
85 TP_PROTO(unsigned long long owner, \
86 unsigned int value1, unsigned int value2), \
87 TP_ARGS(owner, value1, value2))
88
89DEFINE_OCFS2_BTREE_EVENT(ocfs2_adjust_rightmost_branch);
90
91DEFINE_OCFS2_BTREE_EVENT(ocfs2_rotate_tree_right);
92
93DEFINE_OCFS2_BTREE_EVENT(ocfs2_append_rec_to_path);
94
95DEFINE_OCFS2_BTREE_EVENT(ocfs2_insert_extent_start);
96
97DEFINE_OCFS2_BTREE_EVENT(ocfs2_add_clusters_in_btree);
98
99DEFINE_OCFS2_INT_EVENT(ocfs2_num_free_extents);
100
101DEFINE_OCFS2_INT_EVENT(ocfs2_complete_edge_insert);
102
103TRACE_EVENT(ocfs2_grow_tree,
104 TP_PROTO(unsigned long long owner, int depth),
105 TP_ARGS(owner, depth),
106 TP_STRUCT__entry(
107 __field(unsigned long long, owner)
108 __field(int, depth)
109 ),
110 TP_fast_assign(
111 __entry->owner = owner;
112 __entry->depth = depth;
113 ),
114 TP_printk("%llu %d", __entry->owner, __entry->depth)
115);
116
117TRACE_EVENT(ocfs2_rotate_subtree,
118 TP_PROTO(int subtree_root, unsigned long long blkno,
119 int depth),
120 TP_ARGS(subtree_root, blkno, depth),
121 TP_STRUCT__entry(
122 __field(int, subtree_root)
123 __field(unsigned long long, blkno)
124 __field(int, depth)
125 ),
126 TP_fast_assign(
127 __entry->subtree_root = subtree_root;
128 __entry->blkno = blkno;
129 __entry->depth = depth;
130 ),
131 TP_printk("%d %llu %d", __entry->subtree_root,
132 __entry->blkno, __entry->depth)
133);
134
135TRACE_EVENT(ocfs2_insert_extent,
136 TP_PROTO(unsigned int ins_appending, unsigned int ins_contig,
137 int ins_contig_index, int free_records, int ins_tree_depth),
138 TP_ARGS(ins_appending, ins_contig, ins_contig_index, free_records,
139 ins_tree_depth),
140 TP_STRUCT__entry(
141 __field(unsigned int, ins_appending)
142 __field(unsigned int, ins_contig)
143 __field(int, ins_contig_index)
144 __field(int, free_records)
145 __field(int, ins_tree_depth)
146 ),
147 TP_fast_assign(
148 __entry->ins_appending = ins_appending;
149 __entry->ins_contig = ins_contig;
150 __entry->ins_contig_index = ins_contig_index;
151 __entry->free_records = free_records;
152 __entry->ins_tree_depth = ins_tree_depth;
153 ),
154 TP_printk("%u %u %d %d %d",
155 __entry->ins_appending, __entry->ins_contig,
156 __entry->ins_contig_index, __entry->free_records,
157 __entry->ins_tree_depth)
158);
159
160TRACE_EVENT(ocfs2_split_extent,
161 TP_PROTO(int split_index, unsigned int c_contig_type,
162 unsigned int c_has_empty_extent,
163 unsigned int c_split_covers_rec),
164 TP_ARGS(split_index, c_contig_type,
165 c_has_empty_extent, c_split_covers_rec),
166 TP_STRUCT__entry(
167 __field(int, split_index)
168 __field(unsigned int, c_contig_type)
169 __field(unsigned int, c_has_empty_extent)
170 __field(unsigned int, c_split_covers_rec)
171 ),
172 TP_fast_assign(
173 __entry->split_index = split_index;
174 __entry->c_contig_type = c_contig_type;
175 __entry->c_has_empty_extent = c_has_empty_extent;
176 __entry->c_split_covers_rec = c_split_covers_rec;
177 ),
178 TP_printk("%d %u %u %u", __entry->split_index, __entry->c_contig_type,
179 __entry->c_has_empty_extent, __entry->c_split_covers_rec)
180);
181
182TRACE_EVENT(ocfs2_remove_extent,
183 TP_PROTO(unsigned long long owner, unsigned int cpos,
184 unsigned int len, int index,
185 unsigned int e_cpos, unsigned int clusters),
186 TP_ARGS(owner, cpos, len, index, e_cpos, clusters),
187 TP_STRUCT__entry(
188 __field(unsigned long long, owner)
189 __field(unsigned int, cpos)
190 __field(unsigned int, len)
191 __field(int, index)
192 __field(unsigned int, e_cpos)
193 __field(unsigned int, clusters)
194 ),
195 TP_fast_assign(
196 __entry->owner = owner;
197 __entry->cpos = cpos;
198 __entry->len = len;
199 __entry->index = index;
200 __entry->e_cpos = e_cpos;
201 __entry->clusters = clusters;
202 ),
203 TP_printk("%llu %u %u %d %u %u",
204 __entry->owner, __entry->cpos, __entry->len, __entry->index,
205 __entry->e_cpos, __entry->clusters)
206);
207
208TRACE_EVENT(ocfs2_commit_truncate,
209 TP_PROTO(unsigned long long ino, unsigned int new_cpos,
210 unsigned int clusters, unsigned int depth),
211 TP_ARGS(ino, new_cpos, clusters, depth),
212 TP_STRUCT__entry(
213 __field(unsigned long long, ino)
214 __field(unsigned int, new_cpos)
215 __field(unsigned int, clusters)
216 __field(unsigned int, depth)
217 ),
218 TP_fast_assign(
219 __entry->ino = ino;
220 __entry->new_cpos = new_cpos;
221 __entry->clusters = clusters;
222 __entry->depth = depth;
223 ),
224 TP_printk("%llu %u %u %u",
225 __entry->ino, __entry->new_cpos,
226 __entry->clusters, __entry->depth)
227);
228
229TRACE_EVENT(ocfs2_validate_extent_block,
230 TP_PROTO(unsigned long long blkno),
231 TP_ARGS(blkno),
232 TP_STRUCT__entry(
233 __field(unsigned long long, blkno)
234 ),
235 TP_fast_assign(
236 __entry->blkno = blkno;
237 ),
238 TP_printk("%llu ", __entry->blkno)
239);
240
241TRACE_EVENT(ocfs2_rotate_leaf,
242 TP_PROTO(unsigned int insert_cpos, int insert_index,
243 int has_empty, int next_free,
244 unsigned int l_count),
245 TP_ARGS(insert_cpos, insert_index, has_empty,
246 next_free, l_count),
247 TP_STRUCT__entry(
248 __field(unsigned int, insert_cpos)
249 __field(int, insert_index)
250 __field(int, has_empty)
251 __field(int, next_free)
252 __field(unsigned int, l_count)
253 ),
254 TP_fast_assign(
255 __entry->insert_cpos = insert_cpos;
256 __entry->insert_index = insert_index;
257 __entry->has_empty = has_empty;
258 __entry->next_free = next_free;
259 __entry->l_count = l_count;
260 ),
261 TP_printk("%u %d %d %d %u", __entry->insert_cpos,
262 __entry->insert_index, __entry->has_empty,
263 __entry->next_free, __entry->l_count)
264);
265
266TRACE_EVENT(ocfs2_add_clusters_in_btree_ret,
267 TP_PROTO(int status, int reason, int err),
268 TP_ARGS(status, reason, err),
269 TP_STRUCT__entry(
270 __field(int, status)
271 __field(int, reason)
272 __field(int, err)
273 ),
274 TP_fast_assign(
275 __entry->status = status;
276 __entry->reason = reason;
277 __entry->err = err;
278 ),
279 TP_printk("%d %d %d", __entry->status,
280 __entry->reason, __entry->err)
281);
282
283TRACE_EVENT(ocfs2_mark_extent_written,
284 TP_PROTO(unsigned long long owner, unsigned int cpos,
285 unsigned int len, unsigned int phys),
286 TP_ARGS(owner, cpos, len, phys),
287 TP_STRUCT__entry(
288 __field(unsigned long long, owner)
289 __field(unsigned int, cpos)
290 __field(unsigned int, len)
291 __field(unsigned int, phys)
292 ),
293 TP_fast_assign(
294 __entry->owner = owner;
295 __entry->cpos = cpos;
296 __entry->len = len;
297 __entry->phys = phys;
298 ),
299 TP_printk("%llu %u %u %u",
300 __entry->owner, __entry->cpos,
301 __entry->len, __entry->phys)
302);
303
304DECLARE_EVENT_CLASS(ocfs2__truncate_log_ops,
305 TP_PROTO(unsigned long long blkno, int index,
306 unsigned int start, unsigned int num),
307 TP_ARGS(blkno, index, start, num),
308 TP_STRUCT__entry(
309 __field(unsigned long long, blkno)
310 __field(int, index)
311 __field(unsigned int, start)
312 __field(unsigned int, num)
313 ),
314 TP_fast_assign(
315 __entry->blkno = blkno;
316 __entry->index = index;
317 __entry->start = start;
318 __entry->num = num;
319 ),
320 TP_printk("%llu %d %u %u",
321 __entry->blkno, __entry->index,
322 __entry->start, __entry->num)
323);
324
325#define DEFINE_OCFS2_TRUNCATE_LOG_OPS_EVENT(name) \
326DEFINE_EVENT(ocfs2__truncate_log_ops, name, \
327 TP_PROTO(unsigned long long blkno, int index, \
328 unsigned int start, unsigned int num), \
329 TP_ARGS(blkno, index, start, num))
330
331DEFINE_OCFS2_TRUNCATE_LOG_OPS_EVENT(ocfs2_truncate_log_append);
332
333DEFINE_OCFS2_TRUNCATE_LOG_OPS_EVENT(ocfs2_replay_truncate_records);
334
335DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_flush_truncate_log);
336
337DEFINE_OCFS2_INT_EVENT(ocfs2_begin_truncate_log_recovery);
338
339DEFINE_OCFS2_INT_EVENT(ocfs2_truncate_log_recovery_num);
340
341DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_complete_truncate_log_recovery);
342
343DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_free_cached_blocks);
344
345DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_cache_cluster_dealloc);
346
347DEFINE_OCFS2_INT_INT_EVENT(ocfs2_run_deallocs);
348
349TRACE_EVENT(ocfs2_cache_block_dealloc,
350 TP_PROTO(int type, int slot, unsigned long long suballoc,
351 unsigned long long blkno, unsigned int bit),
352 TP_ARGS(type, slot, suballoc, blkno, bit),
353 TP_STRUCT__entry(
354 __field(int, type)
355 __field(int, slot)
356 __field(unsigned long long, suballoc)
357 __field(unsigned long long, blkno)
358 __field(unsigned int, bit)
359 ),
360 TP_fast_assign(
361 __entry->type = type;
362 __entry->slot = slot;
363 __entry->suballoc = suballoc;
364 __entry->blkno = blkno;
365 __entry->bit = bit;
366 ),
367 TP_printk("%d %d %llu %llu %u",
368 __entry->type, __entry->slot, __entry->suballoc,
369 __entry->blkno, __entry->bit)
370);
371
372/* End of trace events for fs/ocfs2/alloc.c. */
9 373
10#endif /* _TRACE_OCFS2_H */ 374#endif /* _TRACE_OCFS2_H */
11 375