aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/localalloc.c57
-rw-r--r--fs/ocfs2/ocfs2_trace.h112
2 files changed, 135 insertions, 34 deletions
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 36636e1c84e7..a311b1f658e2 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -43,6 +43,7 @@
43#include "suballoc.h" 43#include "suballoc.h"
44#include "super.h" 44#include "super.h"
45#include "sysfile.h" 45#include "sysfile.h"
46#include "ocfs2_trace.h"
46 47
47#include "buffer_head_io.h" 48#include "buffer_head_io.h"
48 49
@@ -201,8 +202,7 @@ void ocfs2_la_set_sizes(struct ocfs2_super *osb, int requested_mb)
201 la_max_mb = ocfs2_clusters_to_megabytes(sb, 202 la_max_mb = ocfs2_clusters_to_megabytes(sb,
202 ocfs2_local_alloc_size(sb) * 8); 203 ocfs2_local_alloc_size(sb) * 8);
203 204
204 mlog(0, "requested: %dM, max: %uM, default: %uM\n", 205 trace_ocfs2_la_set_sizes(requested_mb, la_max_mb, la_default_mb);
205 requested_mb, la_max_mb, la_default_mb);
206 206
207 if (requested_mb == -1) { 207 if (requested_mb == -1) {
208 /* No user request - use defaults */ 208 /* No user request - use defaults */
@@ -276,8 +276,8 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits)
276 276
277 ret = 1; 277 ret = 1;
278bail: 278bail:
279 mlog(0, "state=%d, bits=%llu, la_bits=%d, ret=%d\n", 279 trace_ocfs2_alloc_should_use_local(
280 osb->local_alloc_state, (unsigned long long)bits, la_bits, ret); 280 (unsigned long long)bits, osb->local_alloc_state, la_bits, ret);
281 spin_unlock(&osb->osb_lock); 281 spin_unlock(&osb->osb_lock);
282 return ret; 282 return ret;
283} 283}
@@ -362,7 +362,7 @@ bail:
362 if (inode) 362 if (inode)
363 iput(inode); 363 iput(inode);
364 364
365 mlog(0, "Local alloc window bits = %d\n", osb->local_alloc_bits); 365 trace_ocfs2_load_local_alloc(osb->local_alloc_bits);
366 366
367 if (status) 367 if (status)
368 mlog_errno(status); 368 mlog_errno(status);
@@ -497,7 +497,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
497 struct inode *inode = NULL; 497 struct inode *inode = NULL;
498 struct ocfs2_dinode *alloc; 498 struct ocfs2_dinode *alloc;
499 499
500 mlog(0, "(slot_num = %d)\n", slot_num); 500 trace_ocfs2_begin_local_alloc_recovery(slot_num);
501 501
502 *alloc_copy = NULL; 502 *alloc_copy = NULL;
503 503
@@ -705,10 +705,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
705 goto bail; 705 goto bail;
706 } 706 }
707 707
708 if (ac->ac_max_block)
709 mlog(0, "Calling in_range for max block %llu\n",
710 (unsigned long long)ac->ac_max_block);
711
712 ac->ac_inode = local_alloc_inode; 708 ac->ac_inode = local_alloc_inode;
713 /* We should never use localalloc from another slot */ 709 /* We should never use localalloc from another slot */
714 ac->ac_alloc_slot = osb->slot_num; 710 ac->ac_alloc_slot = osb->slot_num;
@@ -722,8 +718,9 @@ bail:
722 iput(local_alloc_inode); 718 iput(local_alloc_inode);
723 } 719 }
724 720
725 mlog(0, "bits=%d, slot=%d, ret=%d\n", bits_wanted, osb->slot_num, 721 trace_ocfs2_reserve_local_alloc_bits(
726 status); 722 (unsigned long long)ac->ac_max_block,
723 bits_wanted, osb->slot_num, status);
727 724
728 if (status) 725 if (status)
729 mlog_errno(status); 726 mlog_errno(status);
@@ -797,7 +794,7 @@ static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
797 for (i = 0; i < le16_to_cpu(la->la_size); i++) 794 for (i = 0; i < le16_to_cpu(la->la_size); i++)
798 count += hweight8(buffer[i]); 795 count += hweight8(buffer[i]);
799 796
800 mlog(0, "count %u\n", count); 797 trace_ocfs2_local_alloc_count_bits(count);
801 return count; 798 return count;
802} 799}
803 800
@@ -812,10 +809,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
812 void *bitmap = NULL; 809 void *bitmap = NULL;
813 struct ocfs2_reservation_map *resmap = &osb->osb_la_resmap; 810 struct ocfs2_reservation_map *resmap = &osb->osb_la_resmap;
814 811
815 mlog(0, "(numbits wanted = %u)\n", *numbits);
816
817 if (!alloc->id1.bitmap1.i_total) { 812 if (!alloc->id1.bitmap1.i_total) {
818 mlog(0, "No bits in my window!\n");
819 bitoff = -1; 813 bitoff = -1;
820 goto bail; 814 goto bail;
821 } 815 }
@@ -875,8 +869,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
875 } 869 }
876 } 870 }
877 871
878 mlog(0, "Exiting loop, bitoff = %d, numfound = %d\n", bitoff, 872 trace_ocfs2_local_alloc_find_clear_bits_search_bitmap(bitoff, numfound);
879 numfound);
880 873
881 if (numfound == *numbits) 874 if (numfound == *numbits)
882 bitoff = startoff - numfound; 875 bitoff = startoff - numfound;
@@ -887,7 +880,10 @@ bail:
887 if (local_resv) 880 if (local_resv)
888 ocfs2_resv_discard(resmap, resv); 881 ocfs2_resv_discard(resmap, resv);
889 882
890 mlog(0, "bitoff %d\n", bitoff); 883 trace_ocfs2_local_alloc_find_clear_bits(*numbits,
884 le32_to_cpu(alloc->id1.bitmap1.i_total),
885 bitoff, numfound);
886
891 return bitoff; 887 return bitoff;
892} 888}
893 889
@@ -941,18 +937,16 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
941 void *bitmap; 937 void *bitmap;
942 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); 938 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
943 939
944 mlog(0, "total = %u, used = %u\n", 940 trace_ocfs2_sync_local_to_main(
945 le32_to_cpu(alloc->id1.bitmap1.i_total), 941 le32_to_cpu(alloc->id1.bitmap1.i_total),
946 le32_to_cpu(alloc->id1.bitmap1.i_used)); 942 le32_to_cpu(alloc->id1.bitmap1.i_used));
947 943
948 if (!alloc->id1.bitmap1.i_total) { 944 if (!alloc->id1.bitmap1.i_total) {
949 mlog(0, "nothing to sync!\n");
950 goto bail; 945 goto bail;
951 } 946 }
952 947
953 if (le32_to_cpu(alloc->id1.bitmap1.i_used) == 948 if (le32_to_cpu(alloc->id1.bitmap1.i_used) ==
954 le32_to_cpu(alloc->id1.bitmap1.i_total)) { 949 le32_to_cpu(alloc->id1.bitmap1.i_total)) {
955 mlog(0, "all bits were taken!\n");
956 goto bail; 950 goto bail;
957 } 951 }
958 952
@@ -974,8 +968,7 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
974 ocfs2_clusters_to_blocks(osb->sb, 968 ocfs2_clusters_to_blocks(osb->sb,
975 start - count); 969 start - count);
976 970
977 mlog(0, "freeing %u bits starting at local alloc bit " 971 trace_ocfs2_sync_local_to_main_free(
978 "%u (la_start_blk = %llu, blkno = %llu)\n",
979 count, start - count, 972 count, start - count,
980 (unsigned long long)la_start_blk, 973 (unsigned long long)la_start_blk,
981 (unsigned long long)blkno); 974 (unsigned long long)blkno);
@@ -1142,12 +1135,9 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
1142 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; 1135 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
1143 la = OCFS2_LOCAL_ALLOC(alloc); 1136 la = OCFS2_LOCAL_ALLOC(alloc);
1144 1137
1145 if (alloc->id1.bitmap1.i_total) 1138 trace_ocfs2_local_alloc_new_window(
1146 mlog(0, "asking me to alloc a new window over a non-empty " 1139 le32_to_cpu(alloc->id1.bitmap1.i_total),
1147 "one\n"); 1140 osb->local_alloc_bits);
1148
1149 mlog(0, "Allocating %u clusters for a new window.\n",
1150 osb->local_alloc_bits);
1151 1141
1152 /* Instruct the allocation code to try the most recently used 1142 /* Instruct the allocation code to try the most recently used
1153 * cluster group. We'll re-record the group used this pass 1143 * cluster group. We'll re-record the group used this pass
@@ -1209,10 +1199,9 @@ retry_enospc:
1209 ocfs2_resmap_restart(&osb->osb_la_resmap, cluster_count, 1199 ocfs2_resmap_restart(&osb->osb_la_resmap, cluster_count,
1210 OCFS2_LOCAL_ALLOC(alloc)->la_bitmap); 1200 OCFS2_LOCAL_ALLOC(alloc)->la_bitmap);
1211 1201
1212 mlog(0, "New window allocated:\n"); 1202 trace_ocfs2_local_alloc_new_window_result(
1213 mlog(0, "window la_bm_off = %u\n", 1203 OCFS2_LOCAL_ALLOC(alloc)->la_bm_off,
1214 OCFS2_LOCAL_ALLOC(alloc)->la_bm_off); 1204 le32_to_cpu(alloc->id1.bitmap1.i_total));
1215 mlog(0, "window bits = %u\n", le32_to_cpu(alloc->id1.bitmap1.i_total));
1216 1205
1217bail: 1206bail:
1218 if (status) 1207 if (status)
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h
index 1793b1f71805..5bba629766ca 100644
--- a/fs/ocfs2/ocfs2_trace.h
+++ b/fs/ocfs2/ocfs2_trace.h
@@ -23,6 +23,23 @@ DEFINE_EVENT(ocfs2__int, name, \
23 TP_PROTO(int num), \ 23 TP_PROTO(int num), \
24 TP_ARGS(num)) 24 TP_ARGS(num))
25 25
26DECLARE_EVENT_CLASS(ocfs2__uint,
27 TP_PROTO(unsigned int num),
28 TP_ARGS(num),
29 TP_STRUCT__entry(
30 __field( unsigned int, num )
31 ),
32 TP_fast_assign(
33 __entry->num = num;
34 ),
35 TP_printk("%u", __entry->num)
36);
37
38#define DEFINE_OCFS2_UINT_EVENT(name) \
39DEFINE_EVENT(ocfs2__uint, name, \
40 TP_PROTO(unsigned int num), \
41 TP_ARGS(num))
42
26DECLARE_EVENT_CLASS(ocfs2__int_int, 43DECLARE_EVENT_CLASS(ocfs2__int_int,
27 TP_PROTO(int value1, int value2), 44 TP_PROTO(int value1, int value2),
28 TP_ARGS(value1, value2), 45 TP_ARGS(value1, value2),
@@ -61,6 +78,55 @@ DEFINE_EVENT(ocfs2__ull_uint, name, \
61 TP_PROTO(unsigned long long val1, unsigned int val2), \ 78 TP_PROTO(unsigned long long val1, unsigned int val2), \
62 TP_ARGS(val1, val2)) 79 TP_ARGS(val1, val2))
63 80
81DECLARE_EVENT_CLASS(ocfs2__uint_uint_uint,
82 TP_PROTO(unsigned int value1, unsigned int value2,
83 unsigned int value3),
84 TP_ARGS(value1, value2, value3),
85 TP_STRUCT__entry(
86 __field( unsigned int, value1 )
87 __field( unsigned int, value2 )
88 __field( unsigned int, value3 )
89 ),
90 TP_fast_assign(
91 __entry->value1 = value1;
92 __entry->value2 = value2;
93 __entry->value3 = value3;
94 ),
95 TP_printk("%u %u %u", __entry->value1, __entry->value2, __entry->value3)
96);
97
98#define DEFINE_OCFS2_UINT_UINT_UINT_EVENT(name) \
99DEFINE_EVENT(ocfs2__uint_uint_uint, name, \
100 TP_PROTO(unsigned int value1, unsigned int value2, \
101 unsigned int value3), \
102 TP_ARGS(value1, value2, value3))
103
104DECLARE_EVENT_CLASS(ocfs2__ull_int_int_int,
105 TP_PROTO(unsigned long long ull, int value1, int value2, int value3),
106 TP_ARGS(ull, value1, value2, value3),
107 TP_STRUCT__entry(
108 __field( unsigned long long, ull )
109 __field( int, value1 )
110 __field( int, value2 )
111 __field( int, value3 )
112 ),
113 TP_fast_assign(
114 __entry->ull = ull;
115 __entry->value1 = value1;
116 __entry->value2 = value2;
117 __entry->value3 = value3;
118 ),
119 TP_printk("%llu %d %d %d",
120 __entry->ull, __entry->value1,
121 __entry->value2, __entry->value3)
122);
123
124#define DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(name) \
125DEFINE_EVENT(ocfs2__ull_int_int_int, name, \
126 TP_PROTO(unsigned long long ull, int value1, \
127 int value2, int value3), \
128 TP_ARGS(ull, value1, value2, value3))
129
64/* Trace events for fs/ocfs2/alloc.c. */ 130/* Trace events for fs/ocfs2/alloc.c. */
65DECLARE_EVENT_CLASS(ocfs2__btree_ops, 131DECLARE_EVENT_CLASS(ocfs2__btree_ops,
66 TP_PROTO(unsigned long long owner,\ 132 TP_PROTO(unsigned long long owner,\
@@ -371,6 +437,52 @@ TRACE_EVENT(ocfs2_cache_block_dealloc,
371 437
372/* End of trace events for fs/ocfs2/alloc.c. */ 438/* End of trace events for fs/ocfs2/alloc.c. */
373 439
440/* Trace events for fs/ocfs2/localalloc.c. */
441
442DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_la_set_sizes);
443
444DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_alloc_should_use_local);
445
446DEFINE_OCFS2_INT_EVENT(ocfs2_load_local_alloc);
447
448DEFINE_OCFS2_INT_EVENT(ocfs2_begin_local_alloc_recovery);
449
450DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_reserve_local_alloc_bits);
451
452DEFINE_OCFS2_UINT_EVENT(ocfs2_local_alloc_count_bits);
453
454DEFINE_OCFS2_INT_INT_EVENT(ocfs2_local_alloc_find_clear_bits_search_bitmap);
455
456DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_local_alloc_find_clear_bits);
457
458DEFINE_OCFS2_INT_INT_EVENT(ocfs2_sync_local_to_main);
459
460TRACE_EVENT(ocfs2_sync_local_to_main_free,
461 TP_PROTO(int count, int bit, unsigned long long start_blk,
462 unsigned long long blkno),
463 TP_ARGS(count, bit, start_blk, blkno),
464 TP_STRUCT__entry(
465 __field(int, count)
466 __field(int, bit)
467 __field(unsigned long long, start_blk)
468 __field(unsigned long long, blkno)
469 ),
470 TP_fast_assign(
471 __entry->count = count;
472 __entry->bit = bit;
473 __entry->start_blk = start_blk;
474 __entry->blkno = blkno;
475 ),
476 TP_printk("%d %d %llu %llu",
477 __entry->count, __entry->bit, __entry->start_blk,
478 __entry->blkno)
479);
480
481DEFINE_OCFS2_INT_INT_EVENT(ocfs2_local_alloc_new_window);
482
483DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_local_alloc_new_window_result);
484
485/* End of trace events for fs/ocfs2/localalloc.c. */
374#endif /* _TRACE_OCFS2_H */ 486#endif /* _TRACE_OCFS2_H */
375 487
376/* This part must be outside protection */ 488/* This part must be outside protection */