aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2011-02-21 19:20:04 -0500
committerTao Ma <boyu.mt@taobao.com>2011-02-21 19:20:04 -0500
commit198aac2838731691ca67e15fd8a56f65307d3677 (patch)
tree87d94f9ab6c82ca3a6379d789f29acf5c8c4f9f4
parent81bad69749623062fae2f94e2d98dd43d95a36f4 (diff)
ocfs2: Remove masklog ML_REFCOUNT.
Change all the "mlog(0," in fs/ocfs2/refcounttree.c to trace events. And finally remove masklog ML_REFCOUNT. Signed-off-by: Tao Ma <boyu.mt@taobao.com>
-rw-r--r--fs/ocfs2/cluster/masklog.c1
-rw-r--r--fs/ocfs2/cluster/masklog.h1
-rw-r--r--fs/ocfs2/ocfs2_trace.h263
-rw-r--r--fs/ocfs2/refcounttree.c158
4 files changed, 341 insertions, 82 deletions
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index caba07c2dac..a961cca1252 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -108,7 +108,6 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
108 define_mask(EXPORT), 108 define_mask(EXPORT),
109 define_mask(XATTR), 109 define_mask(XATTR),
110 define_mask(QUOTA), 110 define_mask(QUOTA),
111 define_mask(REFCOUNT),
112 define_mask(BASTS), 111 define_mask(BASTS),
113 define_mask(RESERVATIONS), 112 define_mask(RESERVATIONS),
114 define_mask(CLUSTER), 113 define_mask(CLUSTER),
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index 155835a6b1c..845ea2b02f0 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -110,7 +110,6 @@
110#define ML_EXPORT 0x0000000010000000ULL /* ocfs2 export operations */ 110#define ML_EXPORT 0x0000000010000000ULL /* ocfs2 export operations */
111#define ML_XATTR 0x0000000020000000ULL /* ocfs2 extended attributes */ 111#define ML_XATTR 0x0000000020000000ULL /* ocfs2 extended attributes */
112#define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */ 112#define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */
113#define ML_REFCOUNT 0x0000000080000000ULL /* refcount tree operations */
114#define ML_BASTS 0x0000000100000000ULL /* dlmglue asts and basts */ 113#define ML_BASTS 0x0000000100000000ULL /* dlmglue asts and basts */
115#define ML_RESERVATIONS 0x0000000200000000ULL /* ocfs2 alloc reservations */ 114#define ML_RESERVATIONS 0x0000000200000000ULL /* ocfs2 alloc reservations */
116#define ML_CLUSTER 0x0000000400000000ULL /* cluster stack */ 115#define ML_CLUSTER 0x0000000400000000ULL /* cluster stack */
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h
index 335edc50f13..a8b57ca7bdb 100644
--- a/fs/ocfs2/ocfs2_trace.h
+++ b/fs/ocfs2/ocfs2_trace.h
@@ -133,6 +133,30 @@ DEFINE_EVENT(ocfs2__ull_ull, name, \
133 TP_PROTO(unsigned long long val1, unsigned long long val2), \ 133 TP_PROTO(unsigned long long val1, unsigned long long val2), \
134 TP_ARGS(val1, val2)) 134 TP_ARGS(val1, val2))
135 135
136DECLARE_EVENT_CLASS(ocfs2__ull_ull_uint,
137 TP_PROTO(unsigned long long value1,
138 unsigned long long value2, unsigned int value3),
139 TP_ARGS(value1, value2, value3),
140 TP_STRUCT__entry(
141 __field(unsigned long long, value1)
142 __field(unsigned long long, value2)
143 __field(unsigned int, value3)
144 ),
145 TP_fast_assign(
146 __entry->value1 = value1;
147 __entry->value2 = value2;
148 __entry->value3 = value3;
149 ),
150 TP_printk("%llu %llu %u",
151 __entry->value1, __entry->value2, __entry->value3)
152);
153
154#define DEFINE_OCFS2_ULL_ULL_UINT_EVENT(name) \
155DEFINE_EVENT(ocfs2__ull_ull_uint, name, \
156 TP_PROTO(unsigned long long val1, \
157 unsigned long long val2, unsigned int val3), \
158 TP_ARGS(val1, val2, val3))
159
136DECLARE_EVENT_CLASS(ocfs2__ull_uint_uint, 160DECLARE_EVENT_CLASS(ocfs2__ull_uint_uint,
137 TP_PROTO(unsigned long long value1, 161 TP_PROTO(unsigned long long value1,
138 unsigned int value2, unsigned int value3), 162 unsigned int value2, unsigned int value3),
@@ -705,6 +729,245 @@ DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_test_suballoc_bit);
705DEFINE_OCFS2_ULL_EVENT(ocfs2_test_inode_bit); 729DEFINE_OCFS2_ULL_EVENT(ocfs2_test_inode_bit);
706 730
707/* End of trace events for fs/ocfs2/suballoc.c. */ 731/* End of trace events for fs/ocfs2/suballoc.c. */
732
733/* Trace events for fs/ocfs2/refcounttree.c. */
734
735DEFINE_OCFS2_ULL_EVENT(ocfs2_validate_refcount_block);
736
737DEFINE_OCFS2_ULL_EVENT(ocfs2_purge_refcount_trees);
738
739DEFINE_OCFS2_ULL_EVENT(ocfs2_create_refcount_tree);
740
741DEFINE_OCFS2_ULL_EVENT(ocfs2_create_refcount_tree_blkno);
742
743DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_change_refcount_rec);
744
745DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_expand_inline_ref_root);
746
747DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_divide_leaf_refcount_block);
748
749DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_new_leaf_refcount_block);
750
751DECLARE_EVENT_CLASS(ocfs2__refcount_tree_ops,
752 TP_PROTO(unsigned long long blkno, int index,
753 unsigned long long cpos,
754 unsigned int clusters, unsigned int refcount),
755 TP_ARGS(blkno, index, cpos, clusters, refcount),
756 TP_STRUCT__entry(
757 __field(unsigned long long, blkno)
758 __field(int, index)
759 __field(unsigned long long, cpos)
760 __field(unsigned int, clusters)
761 __field(unsigned int, refcount)
762 ),
763 TP_fast_assign(
764 __entry->blkno = blkno;
765 __entry->index = index;
766 __entry->cpos = cpos;
767 __entry->clusters = clusters;
768 __entry->refcount = refcount;
769 ),
770 TP_printk("%llu %d %llu %u %u", __entry->blkno, __entry->index,
771 __entry->cpos, __entry->clusters, __entry->refcount)
772);
773
774#define DEFINE_OCFS2_REFCOUNT_TREE_OPS_EVENT(name) \
775DEFINE_EVENT(ocfs2__refcount_tree_ops, name, \
776 TP_PROTO(unsigned long long blkno, int index, \
777 unsigned long long cpos, \
778 unsigned int count, unsigned int refcount), \
779 TP_ARGS(blkno, index, cpos, count, refcount))
780
781DEFINE_OCFS2_REFCOUNT_TREE_OPS_EVENT(ocfs2_insert_refcount_rec);
782
783TRACE_EVENT(ocfs2_split_refcount_rec,
784 TP_PROTO(unsigned long long cpos,
785 unsigned int clusters, unsigned int refcount,
786 unsigned long long split_cpos,
787 unsigned int split_clusters, unsigned int split_refcount),
788 TP_ARGS(cpos, clusters, refcount,
789 split_cpos, split_clusters, split_refcount),
790 TP_STRUCT__entry(
791 __field(unsigned long long, cpos)
792 __field(unsigned int, clusters)
793 __field(unsigned int, refcount)
794 __field(unsigned long long, split_cpos)
795 __field(unsigned int, split_clusters)
796 __field(unsigned int, split_refcount)
797 ),
798 TP_fast_assign(
799 __entry->cpos = cpos;
800 __entry->clusters = clusters;
801 __entry->refcount = refcount;
802 __entry->split_cpos = split_cpos;
803 __entry->split_clusters = split_clusters;
804 __entry->split_refcount = split_refcount;
805 ),
806 TP_printk("%llu %u %u %llu %u %u",
807 __entry->cpos, __entry->clusters, __entry->refcount,
808 __entry->split_cpos, __entry->split_clusters,
809 __entry->split_refcount)
810);
811
812DEFINE_OCFS2_REFCOUNT_TREE_OPS_EVENT(ocfs2_split_refcount_rec_insert);
813
814DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_increase_refcount_begin);
815
816DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_increase_refcount_change);
817
818DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_increase_refcount_insert);
819
820DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_increase_refcount_split);
821
822DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_remove_refcount_extent);
823
824DEFINE_OCFS2_ULL_EVENT(ocfs2_restore_refcount_block);
825
826DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_decrease_refcount_rec);
827
828TRACE_EVENT(ocfs2_decrease_refcount,
829 TP_PROTO(unsigned long long owner,
830 unsigned long long cpos,
831 unsigned int len, int delete),
832 TP_ARGS(owner, cpos, len, delete),
833 TP_STRUCT__entry(
834 __field(unsigned long long, owner)
835 __field(unsigned long long, cpos)
836 __field(unsigned int, len)
837 __field(int, delete)
838 ),
839 TP_fast_assign(
840 __entry->owner = owner;
841 __entry->cpos = cpos;
842 __entry->len = len;
843 __entry->delete = delete;
844 ),
845 TP_printk("%llu %llu %u %d",
846 __entry->owner, __entry->cpos, __entry->len, __entry->delete)
847);
848
849DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_mark_extent_refcounted);
850
851DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_calc_refcount_meta_credits);
852
853TRACE_EVENT(ocfs2_calc_refcount_meta_credits_iterate,
854 TP_PROTO(int recs_add, unsigned long long cpos,
855 unsigned int clusters, unsigned long long r_cpos,
856 unsigned int r_clusters, unsigned int refcount, int index),
857 TP_ARGS(recs_add, cpos, clusters, r_cpos, r_clusters, refcount, index),
858 TP_STRUCT__entry(
859 __field(int, recs_add)
860 __field(unsigned long long, cpos)
861 __field(unsigned int, clusters)
862 __field(unsigned long long, r_cpos)
863 __field(unsigned int, r_clusters)
864 __field(unsigned int, refcount)
865 __field(int, index)
866 ),
867 TP_fast_assign(
868 __entry->recs_add = recs_add;
869 __entry->cpos = cpos;
870 __entry->clusters = clusters;
871 __entry->r_cpos = r_cpos;
872 __entry->r_clusters = r_clusters;
873 __entry->refcount = refcount;
874 __entry->index = index;
875 ),
876 TP_printk("%d %llu %u %llu %u %u %d",
877 __entry->recs_add, __entry->cpos, __entry->clusters,
878 __entry->r_cpos, __entry->r_clusters,
879 __entry->refcount, __entry->index)
880);
881
882DEFINE_OCFS2_INT_INT_EVENT(ocfs2_add_refcount_flag);
883
884DEFINE_OCFS2_INT_INT_EVENT(ocfs2_prepare_refcount_change_for_del);
885
886DEFINE_OCFS2_INT_INT_EVENT(ocfs2_lock_refcount_allocators);
887
888DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_duplicate_clusters_by_page);
889
890DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_duplicate_clusters_by_jbd);
891
892TRACE_EVENT(ocfs2_clear_ext_refcount,
893 TP_PROTO(unsigned long long ino, unsigned int cpos,
894 unsigned int len, unsigned int p_cluster,
895 unsigned int ext_flags),
896 TP_ARGS(ino, cpos, len, p_cluster, ext_flags),
897 TP_STRUCT__entry(
898 __field(unsigned long long, ino)
899 __field(unsigned int, cpos)
900 __field(unsigned int, len)
901 __field(unsigned int, p_cluster)
902 __field(unsigned int, ext_flags)
903 ),
904 TP_fast_assign(
905 __entry->ino = ino;
906 __entry->cpos = cpos;
907 __entry->len = len;
908 __entry->p_cluster = p_cluster;
909 __entry->ext_flags = ext_flags;
910 ),
911 TP_printk("%llu %u %u %u %u",
912 __entry->ino, __entry->cpos, __entry->len,
913 __entry->p_cluster, __entry->ext_flags)
914);
915
916TRACE_EVENT(ocfs2_replace_clusters,
917 TP_PROTO(unsigned long long ino, unsigned int cpos,
918 unsigned int old, unsigned int new, unsigned int len,
919 unsigned int ext_flags),
920 TP_ARGS(ino, cpos, old, new, len, ext_flags),
921 TP_STRUCT__entry(
922 __field(unsigned long long, ino)
923 __field(unsigned int, cpos)
924 __field(unsigned int, old)
925 __field(unsigned int, new)
926 __field(unsigned int, len)
927 __field(unsigned int, ext_flags)
928 ),
929 TP_fast_assign(
930 __entry->ino = ino;
931 __entry->cpos = cpos;
932 __entry->old = old;
933 __entry->new = new;
934 __entry->len = len;
935 __entry->ext_flags = ext_flags;
936 ),
937 TP_printk("%llu %u %u %u %u %u",
938 __entry->ino, __entry->cpos, __entry->old, __entry->new,
939 __entry->len, __entry->ext_flags)
940);
941
942DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_make_clusters_writable);
943
944TRACE_EVENT(ocfs2_refcount_cow_hunk,
945 TP_PROTO(unsigned long long ino, unsigned int cpos,
946 unsigned int write_len, unsigned int max_cpos,
947 unsigned int cow_start, unsigned int cow_len),
948 TP_ARGS(ino, cpos, write_len, max_cpos, cow_start, cow_len),
949 TP_STRUCT__entry(
950 __field(unsigned long long, ino)
951 __field(unsigned int, cpos)
952 __field(unsigned int, write_len)
953 __field(unsigned int, max_cpos)
954 __field(unsigned int, cow_start)
955 __field(unsigned int, cow_len)
956 ),
957 TP_fast_assign(
958 __entry->ino = ino;
959 __entry->cpos = cpos;
960 __entry->write_len = write_len;
961 __entry->max_cpos = max_cpos;
962 __entry->cow_start = cow_start;
963 __entry->cow_len = cow_len;
964 ),
965 TP_printk("%llu %u %u %u %u %u",
966 __entry->ino, __entry->cpos, __entry->write_len,
967 __entry->max_cpos, __entry->cow_start, __entry->cow_len)
968);
969
970/* End of trace events for fs/ocfs2/refcounttree.c. */
708#endif /* _TRACE_OCFS2_H */ 971#endif /* _TRACE_OCFS2_H */
709 972
710/* This part must be outside protection */ 973/* This part must be outside protection */
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 29623da133c..93a81f853e6 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -16,7 +16,6 @@
16 */ 16 */
17 17
18#include <linux/sort.h> 18#include <linux/sort.h>
19#define MLOG_MASK_PREFIX ML_REFCOUNT
20#include <cluster/masklog.h> 19#include <cluster/masklog.h>
21#include "ocfs2.h" 20#include "ocfs2.h"
22#include "inode.h" 21#include "inode.h"
@@ -34,6 +33,7 @@
34#include "aops.h" 33#include "aops.h"
35#include "xattr.h" 34#include "xattr.h"
36#include "namei.h" 35#include "namei.h"
36#include "ocfs2_trace.h"
37 37
38#include <linux/bio.h> 38#include <linux/bio.h>
39#include <linux/blkdev.h> 39#include <linux/blkdev.h>
@@ -84,8 +84,7 @@ static int ocfs2_validate_refcount_block(struct super_block *sb,
84 struct ocfs2_refcount_block *rb = 84 struct ocfs2_refcount_block *rb =
85 (struct ocfs2_refcount_block *)bh->b_data; 85 (struct ocfs2_refcount_block *)bh->b_data;
86 86
87 mlog(0, "Validating refcount block %llu\n", 87 trace_ocfs2_validate_refcount_block((unsigned long long)bh->b_blocknr);
88 (unsigned long long)bh->b_blocknr);
89 88
90 BUG_ON(!buffer_uptodate(bh)); 89 BUG_ON(!buffer_uptodate(bh));
91 90
@@ -545,8 +544,8 @@ void ocfs2_purge_refcount_trees(struct ocfs2_super *osb)
545 while ((node = rb_last(root)) != NULL) { 544 while ((node = rb_last(root)) != NULL) {
546 tree = rb_entry(node, struct ocfs2_refcount_tree, rf_node); 545 tree = rb_entry(node, struct ocfs2_refcount_tree, rf_node);
547 546
548 mlog(0, "Purge tree %llu\n", 547 trace_ocfs2_purge_refcount_trees(
549 (unsigned long long) tree->rf_blkno); 548 (unsigned long long) tree->rf_blkno);
550 549
551 rb_erase(&tree->rf_node, root); 550 rb_erase(&tree->rf_node, root);
552 ocfs2_free_refcount_tree(tree); 551 ocfs2_free_refcount_tree(tree);
@@ -575,7 +574,8 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
575 574
576 BUG_ON(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL); 575 BUG_ON(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL);
577 576
578 mlog(0, "create tree for inode %lu\n", inode->i_ino); 577 trace_ocfs2_create_refcount_tree(
578 (unsigned long long)OCFS2_I(inode)->ip_blkno);
579 579
580 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac); 580 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac);
581 if (ret) { 581 if (ret) {
@@ -646,8 +646,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
646 di->i_refcount_loc = cpu_to_le64(first_blkno); 646 di->i_refcount_loc = cpu_to_le64(first_blkno);
647 spin_unlock(&oi->ip_lock); 647 spin_unlock(&oi->ip_lock);
648 648
649 mlog(0, "created tree for inode %lu, refblock %llu\n", 649 trace_ocfs2_create_refcount_tree_blkno((unsigned long long)first_blkno);
650 inode->i_ino, (unsigned long long)first_blkno);
651 650
652 ocfs2_journal_dirty(handle, di_bh); 651 ocfs2_journal_dirty(handle, di_bh);
653 652
@@ -1256,8 +1255,9 @@ static int ocfs2_change_refcount_rec(handle_t *handle,
1256 goto out; 1255 goto out;
1257 } 1256 }
1258 1257
1259 mlog(0, "change index %d, old count %u, change %d\n", index, 1258 trace_ocfs2_change_refcount_rec(
1260 le32_to_cpu(rec->r_refcount), change); 1259 (unsigned long long)ocfs2_metadata_cache_owner(ci),
1260 index, le32_to_cpu(rec->r_refcount), change);
1261 le32_add_cpu(&rec->r_refcount, change); 1261 le32_add_cpu(&rec->r_refcount, change);
1262 1262
1263 if (!rec->r_refcount) { 1263 if (!rec->r_refcount) {
@@ -1353,8 +1353,8 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle,
1353 1353
1354 ocfs2_journal_dirty(handle, ref_root_bh); 1354 ocfs2_journal_dirty(handle, ref_root_bh);
1355 1355
1356 mlog(0, "new leaf block %llu, used %u\n", (unsigned long long)blkno, 1356 trace_ocfs2_expand_inline_ref_root((unsigned long long)blkno,
1357 le16_to_cpu(new_rb->rf_records.rl_used)); 1357 le16_to_cpu(new_rb->rf_records.rl_used));
1358 1358
1359 *ref_leaf_bh = new_bh; 1359 *ref_leaf_bh = new_bh;
1360 new_bh = NULL; 1360 new_bh = NULL;
@@ -1466,9 +1466,9 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh,
1466 (struct ocfs2_refcount_block *)new_bh->b_data; 1466 (struct ocfs2_refcount_block *)new_bh->b_data;
1467 struct ocfs2_refcount_list *new_rl = &new_rb->rf_records; 1467 struct ocfs2_refcount_list *new_rl = &new_rb->rf_records;
1468 1468
1469 mlog(0, "split old leaf refcount block %llu, count = %u, used = %u\n", 1469 trace_ocfs2_divide_leaf_refcount_block(
1470 (unsigned long long)ref_leaf_bh->b_blocknr, 1470 (unsigned long long)ref_leaf_bh->b_blocknr,
1471 le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used)); 1471 le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used));
1472 1472
1473 /* 1473 /*
1474 * XXX: Improvement later. 1474 * XXX: Improvement later.
@@ -1601,8 +1601,8 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle,
1601 1601
1602 ocfs2_init_refcount_extent_tree(&ref_et, ci, ref_root_bh); 1602 ocfs2_init_refcount_extent_tree(&ref_et, ci, ref_root_bh);
1603 1603
1604 mlog(0, "insert new leaf block %llu at %u\n", 1604 trace_ocfs2_new_leaf_refcount_block(
1605 (unsigned long long)new_bh->b_blocknr, new_cpos); 1605 (unsigned long long)new_bh->b_blocknr, new_cpos);
1606 1606
1607 /* Insert the new leaf block with the specific offset cpos. */ 1607 /* Insert the new leaf block with the specific offset cpos. */
1608 ret = ocfs2_insert_extent(handle, &ref_et, new_cpos, new_bh->b_blocknr, 1608 ret = ocfs2_insert_extent(handle, &ref_et, new_cpos, new_bh->b_blocknr,
@@ -1794,11 +1794,10 @@ static int ocfs2_insert_refcount_rec(handle_t *handle,
1794 (le16_to_cpu(rf_list->rl_used) - index) * 1794 (le16_to_cpu(rf_list->rl_used) - index) *
1795 sizeof(struct ocfs2_refcount_rec)); 1795 sizeof(struct ocfs2_refcount_rec));
1796 1796
1797 mlog(0, "insert refcount record start %llu, len %u, count %u " 1797 trace_ocfs2_insert_refcount_rec(
1798 "to leaf block %llu at index %d\n", 1798 (unsigned long long)ref_leaf_bh->b_blocknr, index,
1799 (unsigned long long)le64_to_cpu(rec->r_cpos), 1799 (unsigned long long)le64_to_cpu(rec->r_cpos),
1800 le32_to_cpu(rec->r_clusters), le32_to_cpu(rec->r_refcount), 1800 le32_to_cpu(rec->r_clusters), le32_to_cpu(rec->r_refcount));
1801 (unsigned long long)ref_leaf_bh->b_blocknr, index);
1802 1801
1803 rf_list->rl_recs[index] = *rec; 1802 rf_list->rl_recs[index] = *rec;
1804 1803
@@ -1850,10 +1849,12 @@ static int ocfs2_split_refcount_rec(handle_t *handle,
1850 1849
1851 BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL); 1850 BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL);
1852 1851
1853 mlog(0, "original r_pos %llu, cluster %u, split %llu, cluster %u\n", 1852 trace_ocfs2_split_refcount_rec(le64_to_cpu(orig_rec->r_cpos),
1854 le64_to_cpu(orig_rec->r_cpos), le32_to_cpu(orig_rec->r_clusters), 1853 le32_to_cpu(orig_rec->r_clusters),
1855 le64_to_cpu(split_rec->r_cpos), 1854 le32_to_cpu(orig_rec->r_refcount),
1856 le32_to_cpu(split_rec->r_clusters)); 1855 le64_to_cpu(split_rec->r_cpos),
1856 le32_to_cpu(split_rec->r_clusters),
1857 le32_to_cpu(split_rec->r_refcount));
1857 1858
1858 /* 1859 /*
1859 * If we just need to split the header or tail clusters, 1860 * If we just need to split the header or tail clusters,
@@ -1967,12 +1968,11 @@ static int ocfs2_split_refcount_rec(handle_t *handle,
1967 1968
1968 if (split_rec->r_refcount) { 1969 if (split_rec->r_refcount) {
1969 rf_list->rl_recs[index] = *split_rec; 1970 rf_list->rl_recs[index] = *split_rec;
1970 mlog(0, "insert refcount record start %llu, len %u, count %u " 1971 trace_ocfs2_split_refcount_rec_insert(
1971 "to leaf block %llu at index %d\n", 1972 (unsigned long long)ref_leaf_bh->b_blocknr, index,
1972 (unsigned long long)le64_to_cpu(split_rec->r_cpos), 1973 (unsigned long long)le64_to_cpu(split_rec->r_cpos),
1973 le32_to_cpu(split_rec->r_clusters), 1974 le32_to_cpu(split_rec->r_clusters),
1974 le32_to_cpu(split_rec->r_refcount), 1975 le32_to_cpu(split_rec->r_refcount));
1975 (unsigned long long)ref_leaf_bh->b_blocknr, index);
1976 1976
1977 if (merge) 1977 if (merge)
1978 ocfs2_refcount_rec_merge(rb, index); 1978 ocfs2_refcount_rec_merge(rb, index);
@@ -1997,7 +1997,7 @@ static int __ocfs2_increase_refcount(handle_t *handle,
1997 struct ocfs2_refcount_rec rec; 1997 struct ocfs2_refcount_rec rec;
1998 unsigned int set_len = 0; 1998 unsigned int set_len = 0;
1999 1999
2000 mlog(0, "Tree owner %llu, add refcount start %llu, len %u\n", 2000 trace_ocfs2_increase_refcount_begin(
2001 (unsigned long long)ocfs2_metadata_cache_owner(ci), 2001 (unsigned long long)ocfs2_metadata_cache_owner(ci),
2002 (unsigned long long)cpos, len); 2002 (unsigned long long)cpos, len);
2003 2003
@@ -2024,9 +2024,9 @@ static int __ocfs2_increase_refcount(handle_t *handle,
2024 */ 2024 */
2025 if (rec.r_refcount && le64_to_cpu(rec.r_cpos) == cpos && 2025 if (rec.r_refcount && le64_to_cpu(rec.r_cpos) == cpos &&
2026 set_len <= len) { 2026 set_len <= len) {
2027 mlog(0, "increase refcount rec, start %llu, len %u, " 2027 trace_ocfs2_increase_refcount_change(
2028 "count %u\n", (unsigned long long)cpos, set_len, 2028 (unsigned long long)cpos, set_len,
2029 le32_to_cpu(rec.r_refcount)); 2029 le32_to_cpu(rec.r_refcount));
2030 ret = ocfs2_change_refcount_rec(handle, ci, 2030 ret = ocfs2_change_refcount_rec(handle, ci,
2031 ref_leaf_bh, index, 2031 ref_leaf_bh, index,
2032 merge, 1); 2032 merge, 1);
@@ -2037,7 +2037,7 @@ static int __ocfs2_increase_refcount(handle_t *handle,
2037 } else if (!rec.r_refcount) { 2037 } else if (!rec.r_refcount) {
2038 rec.r_refcount = cpu_to_le32(1); 2038 rec.r_refcount = cpu_to_le32(1);
2039 2039
2040 mlog(0, "insert refcount rec, start %llu, len %u\n", 2040 trace_ocfs2_increase_refcount_insert(
2041 (unsigned long long)le64_to_cpu(rec.r_cpos), 2041 (unsigned long long)le64_to_cpu(rec.r_cpos),
2042 set_len); 2042 set_len);
2043 ret = ocfs2_insert_refcount_rec(handle, ci, ref_root_bh, 2043 ret = ocfs2_insert_refcount_rec(handle, ci, ref_root_bh,
@@ -2055,8 +2055,7 @@ static int __ocfs2_increase_refcount(handle_t *handle,
2055 rec.r_clusters = cpu_to_le32(set_len); 2055 rec.r_clusters = cpu_to_le32(set_len);
2056 le32_add_cpu(&rec.r_refcount, 1); 2056 le32_add_cpu(&rec.r_refcount, 1);
2057 2057
2058 mlog(0, "split refcount rec, start %llu, " 2058 trace_ocfs2_increase_refcount_split(
2059 "len %u, count %u\n",
2060 (unsigned long long)le64_to_cpu(rec.r_cpos), 2059 (unsigned long long)le64_to_cpu(rec.r_cpos),
2061 set_len, le32_to_cpu(rec.r_refcount)); 2060 set_len, le32_to_cpu(rec.r_refcount));
2062 ret = ocfs2_split_refcount_rec(handle, ci, 2061 ret = ocfs2_split_refcount_rec(handle, ci,
@@ -2095,6 +2094,11 @@ static int ocfs2_remove_refcount_extent(handle_t *handle,
2095 2094
2096 BUG_ON(rb->rf_records.rl_used); 2095 BUG_ON(rb->rf_records.rl_used);
2097 2096
2097 trace_ocfs2_remove_refcount_extent(
2098 (unsigned long long)ocfs2_metadata_cache_owner(ci),
2099 (unsigned long long)ref_leaf_bh->b_blocknr,
2100 le32_to_cpu(rb->rf_cpos));
2101
2098 ocfs2_init_refcount_extent_tree(&et, ci, ref_root_bh); 2102 ocfs2_init_refcount_extent_tree(&et, ci, ref_root_bh);
2099 ret = ocfs2_remove_extent(handle, &et, le32_to_cpu(rb->rf_cpos), 2103 ret = ocfs2_remove_extent(handle, &et, le32_to_cpu(rb->rf_cpos),
2100 1, meta_ac, dealloc); 2104 1, meta_ac, dealloc);
@@ -2137,7 +2141,7 @@ static int ocfs2_remove_refcount_extent(handle_t *handle,
2137 if (!rb->rf_list.l_next_free_rec) { 2141 if (!rb->rf_list.l_next_free_rec) {
2138 BUG_ON(rb->rf_clusters); 2142 BUG_ON(rb->rf_clusters);
2139 2143
2140 mlog(0, "reset refcount tree root %llu to be a record block.\n", 2144 trace_ocfs2_restore_refcount_block(
2141 (unsigned long long)ref_root_bh->b_blocknr); 2145 (unsigned long long)ref_root_bh->b_blocknr);
2142 2146
2143 rb->rf_flags = 0; 2147 rb->rf_flags = 0;
@@ -2184,6 +2188,10 @@ static int ocfs2_decrease_refcount_rec(handle_t *handle,
2184 BUG_ON(cpos + len > 2188 BUG_ON(cpos + len >
2185 le64_to_cpu(rec->r_cpos) + le32_to_cpu(rec->r_clusters)); 2189 le64_to_cpu(rec->r_cpos) + le32_to_cpu(rec->r_clusters));
2186 2190
2191 trace_ocfs2_decrease_refcount_rec(
2192 (unsigned long long)ocfs2_metadata_cache_owner(ci),
2193 (unsigned long long)cpos, len);
2194
2187 if (cpos == le64_to_cpu(rec->r_cpos) && 2195 if (cpos == le64_to_cpu(rec->r_cpos) &&
2188 len == le32_to_cpu(rec->r_clusters)) 2196 len == le32_to_cpu(rec->r_clusters))
2189 ret = ocfs2_change_refcount_rec(handle, ci, 2197 ret = ocfs2_change_refcount_rec(handle, ci,
@@ -2195,12 +2203,6 @@ static int ocfs2_decrease_refcount_rec(handle_t *handle,
2195 2203
2196 le32_add_cpu(&split.r_refcount, -1); 2204 le32_add_cpu(&split.r_refcount, -1);
2197 2205
2198 mlog(0, "split refcount rec, start %llu, "
2199 "len %u, count %u, original start %llu, len %u\n",
2200 (unsigned long long)le64_to_cpu(split.r_cpos),
2201 len, le32_to_cpu(split.r_refcount),
2202 (unsigned long long)le64_to_cpu(rec->r_cpos),
2203 le32_to_cpu(rec->r_clusters));
2204 ret = ocfs2_split_refcount_rec(handle, ci, 2206 ret = ocfs2_split_refcount_rec(handle, ci,
2205 ref_root_bh, ref_leaf_bh, 2207 ref_root_bh, ref_leaf_bh,
2206 &split, index, 1, 2208 &split, index, 1,
@@ -2239,10 +2241,9 @@ static int __ocfs2_decrease_refcount(handle_t *handle,
2239 struct super_block *sb = ocfs2_metadata_cache_get_super(ci); 2241 struct super_block *sb = ocfs2_metadata_cache_get_super(ci);
2240 struct buffer_head *ref_leaf_bh = NULL; 2242 struct buffer_head *ref_leaf_bh = NULL;
2241 2243
2242 mlog(0, "Tree owner %llu, decrease refcount start %llu, " 2244 trace_ocfs2_decrease_refcount(
2243 "len %u, delete %u\n", 2245 (unsigned long long)ocfs2_metadata_cache_owner(ci),
2244 (unsigned long long)ocfs2_metadata_cache_owner(ci), 2246 (unsigned long long)cpos, len, delete);
2245 (unsigned long long)cpos, len, delete);
2246 2247
2247 while (len) { 2248 while (len) {
2248 ret = ocfs2_get_refcount_rec(ci, ref_root_bh, 2249 ret = ocfs2_get_refcount_rec(ci, ref_root_bh,
@@ -2352,8 +2353,8 @@ static int ocfs2_mark_extent_refcounted(struct inode *inode,
2352{ 2353{
2353 int ret; 2354 int ret;
2354 2355
2355 mlog(0, "Inode %lu refcount tree cpos %u, len %u, phys cluster %u\n", 2356 trace_ocfs2_mark_extent_refcounted(OCFS2_I(inode)->ip_blkno,
2356 inode->i_ino, cpos, len, phys); 2357 cpos, len, phys);
2357 2358
2358 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { 2359 if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) {
2359 ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " 2360 ocfs2_error(inode->i_sb, "Inode %lu want to use refcount "
@@ -2392,8 +2393,6 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2392 struct buffer_head *ref_leaf_bh = NULL, *prev_bh = NULL; 2393 struct buffer_head *ref_leaf_bh = NULL, *prev_bh = NULL;
2393 u32 len; 2394 u32 len;
2394 2395
2395 mlog(0, "start_cpos %llu, clusters %u\n",
2396 (unsigned long long)start_cpos, clusters);
2397 while (clusters) { 2396 while (clusters) {
2398 ret = ocfs2_get_refcount_rec(ci, ref_root_bh, 2397 ret = ocfs2_get_refcount_rec(ci, ref_root_bh,
2399 cpos, clusters, &rec, 2398 cpos, clusters, &rec,
@@ -2427,12 +2426,11 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2427 2426
2428 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; 2427 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data;
2429 2428
2430 mlog(0, "recs_add %d,cpos %llu, clusters %u, rec->r_cpos %llu," 2429 trace_ocfs2_calc_refcount_meta_credits_iterate(
2431 "rec->r_clusters %u, rec->r_refcount %u, index %d\n", 2430 recs_add, (unsigned long long)cpos, clusters,
2432 recs_add, (unsigned long long)cpos, clusters, 2431 (unsigned long long)le64_to_cpu(rec.r_cpos),
2433 (unsigned long long)le64_to_cpu(rec.r_cpos), 2432 le32_to_cpu(rec.r_clusters),
2434 le32_to_cpu(rec.r_clusters), 2433 le32_to_cpu(rec.r_refcount), index);
2435 le32_to_cpu(rec.r_refcount), index);
2436 2434
2437 len = min((u64)cpos + clusters, le64_to_cpu(rec.r_cpos) + 2435 len = min((u64)cpos + clusters, le64_to_cpu(rec.r_cpos) +
2438 le32_to_cpu(rec.r_clusters)) - cpos; 2436 le32_to_cpu(rec.r_clusters)) - cpos;
@@ -2488,7 +2486,6 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2488 if (!ref_blocks) 2486 if (!ref_blocks)
2489 goto out; 2487 goto out;
2490 2488
2491 mlog(0, "we need ref_blocks %d\n", ref_blocks);
2492 *meta_add += ref_blocks; 2489 *meta_add += ref_blocks;
2493 *credits += ref_blocks; 2490 *credits += ref_blocks;
2494 2491
@@ -2514,6 +2511,10 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2514 } 2511 }
2515 2512
2516out: 2513out:
2514
2515 trace_ocfs2_calc_refcount_meta_credits(
2516 (unsigned long long)start_cpos, clusters,
2517 *meta_add, *credits);
2517 brelse(ref_leaf_bh); 2518 brelse(ref_leaf_bh);
2518 brelse(prev_bh); 2519 brelse(prev_bh);
2519 return ret; 2520 return ret;
@@ -2578,8 +2579,7 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode,
2578 goto out; 2579 goto out;
2579 } 2580 }
2580 2581
2581 mlog(0, "reserve new metadata %d blocks, credits = %d\n", 2582 trace_ocfs2_prepare_refcount_change_for_del(*ref_blocks, *credits);
2582 *ref_blocks, *credits);
2583 2583
2584out: 2584out:
2585 brelse(ref_root_bh); 2585 brelse(ref_root_bh);
@@ -2886,8 +2886,7 @@ static int ocfs2_lock_refcount_allocators(struct super_block *sb,
2886 goto out; 2886 goto out;
2887 } 2887 }
2888 2888
2889 mlog(0, "reserve new metadata %d, clusters %u, credits = %d\n", 2889 trace_ocfs2_lock_refcount_allocators(meta_add, *credits);
2890 meta_add, num_clusters, *credits);
2891 ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(sb), meta_add, 2890 ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(sb), meta_add,
2892 meta_ac); 2891 meta_ac);
2893 if (ret) { 2892 if (ret) {
@@ -2937,8 +2936,8 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle,
2937 loff_t offset, end, map_end; 2936 loff_t offset, end, map_end;
2938 struct address_space *mapping = context->inode->i_mapping; 2937 struct address_space *mapping = context->inode->i_mapping;
2939 2938
2940 mlog(0, "old_cluster %u, new %u, len %u at offset %u\n", old_cluster, 2939 trace_ocfs2_duplicate_clusters_by_page(cpos, old_cluster,
2941 new_cluster, new_len, cpos); 2940 new_cluster, new_len);
2942 2941
2943 readahead_pages = 2942 readahead_pages =
2944 (ocfs2_cow_contig_clusters(sb) << 2943 (ocfs2_cow_contig_clusters(sb) <<
@@ -3031,8 +3030,8 @@ static int ocfs2_duplicate_clusters_by_jbd(handle_t *handle,
3031 struct buffer_head *old_bh = NULL; 3030 struct buffer_head *old_bh = NULL;
3032 struct buffer_head *new_bh = NULL; 3031 struct buffer_head *new_bh = NULL;
3033 3032
3034 mlog(0, "old_cluster %u, new %u, len %u\n", old_cluster, 3033 trace_ocfs2_duplicate_clusters_by_page(cpos, old_cluster,
3035 new_cluster, new_len); 3034 new_cluster, new_len);
3036 3035
3037 for (i = 0; i < blocks; i++, old_block++, new_block++) { 3036 for (i = 0; i < blocks; i++, old_block++, new_block++) {
3038 new_bh = sb_getblk(osb->sb, new_block); 3037 new_bh = sb_getblk(osb->sb, new_block);
@@ -3085,8 +3084,8 @@ static int ocfs2_clear_ext_refcount(handle_t *handle,
3085 struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci); 3084 struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci);
3086 u64 ino = ocfs2_metadata_cache_owner(et->et_ci); 3085 u64 ino = ocfs2_metadata_cache_owner(et->et_ci);
3087 3086
3088 mlog(0, "inode %llu cpos %u, len %u, p_cluster %u, ext_flags %u\n", 3087 trace_ocfs2_clear_ext_refcount((unsigned long long)ino,
3089 (unsigned long long)ino, cpos, len, p_cluster, ext_flags); 3088 cpos, len, p_cluster, ext_flags);
3090 3089
3091 memset(&replace_rec, 0, sizeof(replace_rec)); 3090 memset(&replace_rec, 0, sizeof(replace_rec));
3092 replace_rec.e_cpos = cpu_to_le32(cpos); 3091 replace_rec.e_cpos = cpu_to_le32(cpos);
@@ -3141,8 +3140,8 @@ static int ocfs2_replace_clusters(handle_t *handle,
3141 struct ocfs2_caching_info *ci = context->data_et.et_ci; 3140 struct ocfs2_caching_info *ci = context->data_et.et_ci;
3142 u64 ino = ocfs2_metadata_cache_owner(ci); 3141 u64 ino = ocfs2_metadata_cache_owner(ci);
3143 3142
3144 mlog(0, "inode %llu, cpos %u, old %u, new %u, len %u, ext_flags %u\n", 3143 trace_ocfs2_replace_clusters((unsigned long long)ino,
3145 (unsigned long long)ino, cpos, old, new, len, ext_flags); 3144 cpos, old, new, len, ext_flags);
3146 3145
3147 /*If the old clusters is unwritten, no need to duplicate. */ 3146 /*If the old clusters is unwritten, no need to duplicate. */
3148 if (!(ext_flags & OCFS2_EXT_UNWRITTEN)) { 3147 if (!(ext_flags & OCFS2_EXT_UNWRITTEN)) {
@@ -3236,8 +3235,8 @@ static int ocfs2_make_clusters_writable(struct super_block *sb,
3236 struct ocfs2_caching_info *ref_ci = &context->ref_tree->rf_ci; 3235 struct ocfs2_caching_info *ref_ci = &context->ref_tree->rf_ci;
3237 struct ocfs2_refcount_rec rec; 3236 struct ocfs2_refcount_rec rec;
3238 3237
3239 mlog(0, "cpos %u, p_cluster %u, num_clusters %u, e_flags %u\n", 3238 trace_ocfs2_make_clusters_writable(cpos, p_cluster,
3240 cpos, p_cluster, num_clusters, e_flags); 3239 num_clusters, e_flags);
3241 3240
3242 ret = ocfs2_lock_refcount_allocators(sb, p_cluster, num_clusters, 3241 ret = ocfs2_lock_refcount_allocators(sb, p_cluster, num_clusters,
3243 &context->data_et, 3242 &context->data_et,
@@ -3475,9 +3474,9 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode,
3475 goto out; 3474 goto out;
3476 } 3475 }
3477 3476
3478 mlog(0, "CoW inode %lu, cpos %u, write_len %u, cow_start %u, " 3477 trace_ocfs2_refcount_cow_hunk(OCFS2_I(inode)->ip_blkno,
3479 "cow_len %u\n", inode->i_ino, 3478 cpos, write_len, max_cpos,
3480 cpos, write_len, cow_start, cow_len); 3479 cow_start, cow_len);
3481 3480
3482 BUG_ON(cow_len == 0); 3481 BUG_ON(cow_len == 0);
3483 3482
@@ -3756,8 +3755,7 @@ int ocfs2_add_refcount_flag(struct inode *inode,
3756 goto out; 3755 goto out;
3757 } 3756 }
3758 3757
3759 mlog(0, "reserve new metadata %d, credits = %d\n", 3758 trace_ocfs2_add_refcount_flag(ref_blocks, credits);
3760 ref_blocks, credits);
3761 3759
3762 if (ref_blocks) { 3760 if (ref_blocks) {
3763 ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb), 3761 ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb),