4343#include "suballoc.h"
4444#include "super.h"
4545#include "sysfile.h"
46+ #include "ocfs2_trace.h"
4647
4748#include "buffer_head_io.h"
4849
@@ -201,8 +202,7 @@ void ocfs2_la_set_sizes(struct ocfs2_super *osb, int requested_mb)
201202 la_max_mb = ocfs2_clusters_to_megabytes (sb ,
202203 ocfs2_local_alloc_size (sb ) * 8 );
203204
204- mlog (0 , "requested: %dM, max: %uM, default: %uM\n" ,
205- requested_mb , la_max_mb , la_default_mb );
205+ trace_ocfs2_la_set_sizes (requested_mb , la_max_mb , la_default_mb );
206206
207207 if (requested_mb == -1 ) {
208208 /* No user request - use defaults */
@@ -276,8 +276,8 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits)
276276
277277 ret = 1 ;
278278bail :
279- mlog ( 0 , "state=%d, bits=%llu, la_bits=%d, ret=%d\n" ,
280- osb -> local_alloc_state , (unsigned long long )bits , la_bits , ret );
279+ trace_ocfs2_alloc_should_use_local (
280+ (unsigned long long )bits , osb -> local_alloc_state , la_bits , ret );
281281 spin_unlock (& osb -> osb_lock );
282282 return ret ;
283283}
@@ -362,7 +362,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
362362 if (inode )
363363 iput (inode );
364364
365- mlog ( 0 , "Local alloc window bits = %d\n" , osb -> local_alloc_bits );
365+ trace_ocfs2_load_local_alloc ( osb -> local_alloc_bits );
366366
367367 if (status )
368368 mlog_errno (status );
@@ -497,7 +497,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
497497 struct inode * inode = NULL ;
498498 struct ocfs2_dinode * alloc ;
499499
500- mlog ( 0 , "(slot_num = %d)\n" , slot_num );
500+ trace_ocfs2_begin_local_alloc_recovery ( slot_num );
501501
502502 * alloc_copy = NULL ;
503503
@@ -705,10 +705,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
705705 goto bail ;
706706 }
707707
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-
712708 ac -> ac_inode = local_alloc_inode ;
713709 /* We should never use localalloc from another slot */
714710 ac -> ac_alloc_slot = osb -> slot_num ;
@@ -722,8 +718,9 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
722718 iput (local_alloc_inode );
723719 }
724720
725- mlog (0 , "bits=%d, slot=%d, ret=%d\n" , bits_wanted , osb -> slot_num ,
726- status );
721+ trace_ocfs2_reserve_local_alloc_bits (
722+ (unsigned long long )ac -> ac_max_block ,
723+ bits_wanted , osb -> slot_num , status );
727724
728725 if (status )
729726 mlog_errno (status );
@@ -797,7 +794,7 @@ static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
797794 for (i = 0 ; i < le16_to_cpu (la -> la_size ); i ++ )
798795 count += hweight8 (buffer [i ]);
799796
800- mlog ( 0 , "count %u\n" , count );
797+ trace_ocfs2_local_alloc_count_bits ( count );
801798 return count ;
802799}
803800
@@ -812,10 +809,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
812809 void * bitmap = NULL ;
813810 struct ocfs2_reservation_map * resmap = & osb -> osb_la_resmap ;
814811
815- mlog (0 , "(numbits wanted = %u)\n" , * numbits );
816-
817812 if (!alloc -> id1 .bitmap1 .i_total ) {
818- mlog (0 , "No bits in my window!\n" );
819813 bitoff = -1 ;
820814 goto bail ;
821815 }
@@ -875,8 +869,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
875869 }
876870 }
877871
878- mlog (0 , "Exiting loop, bitoff = %d, numfound = %d\n" , bitoff ,
879- numfound );
872+ trace_ocfs2_local_alloc_find_clear_bits_search_bitmap (bitoff , numfound );
880873
881874 if (numfound == * numbits )
882875 bitoff = startoff - numfound ;
@@ -887,7 +880,10 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
887880 if (local_resv )
888881 ocfs2_resv_discard (resmap , resv );
889882
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+
891887 return bitoff ;
892888}
893889
@@ -941,18 +937,16 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
941937 void * bitmap ;
942938 struct ocfs2_local_alloc * la = OCFS2_LOCAL_ALLOC (alloc );
943939
944- mlog ( 0 , "total = %u, used = %u\n" ,
940+ trace_ocfs2_sync_local_to_main (
945941 le32_to_cpu (alloc -> id1 .bitmap1 .i_total ),
946942 le32_to_cpu (alloc -> id1 .bitmap1 .i_used ));
947943
948944 if (!alloc -> id1 .bitmap1 .i_total ) {
949- mlog (0 , "nothing to sync!\n" );
950945 goto bail ;
951946 }
952947
953948 if (le32_to_cpu (alloc -> id1 .bitmap1 .i_used ) ==
954949 le32_to_cpu (alloc -> id1 .bitmap1 .i_total )) {
955- mlog (0 , "all bits were taken!\n" );
956950 goto bail ;
957951 }
958952
@@ -974,8 +968,7 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
974968 ocfs2_clusters_to_blocks (osb -> sb ,
975969 start - count );
976970
977- mlog (0 , "freeing %u bits starting at local alloc bit "
978- "%u (la_start_blk = %llu, blkno = %llu)\n" ,
971+ trace_ocfs2_sync_local_to_main_free (
979972 count , start - count ,
980973 (unsigned long long )la_start_blk ,
981974 (unsigned long long )blkno );
@@ -1142,12 +1135,9 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
11421135 alloc = (struct ocfs2_dinode * ) osb -> local_alloc_bh -> b_data ;
11431136 la = OCFS2_LOCAL_ALLOC (alloc );
11441137
1145- if (alloc -> id1 .bitmap1 .i_total )
1146- mlog (0 , "asking me to alloc a new window over a non-empty "
1147- "one\n" );
1148-
1149- mlog (0 , "Allocating %u clusters for a new window.\n" ,
1150- osb -> local_alloc_bits );
1138+ trace_ocfs2_local_alloc_new_window (
1139+ le32_to_cpu (alloc -> id1 .bitmap1 .i_total ),
1140+ osb -> local_alloc_bits );
11511141
11521142 /* Instruct the allocation code to try the most recently used
11531143 * cluster group. We'll re-record the group used this pass
@@ -1209,10 +1199,9 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
12091199 ocfs2_resmap_restart (& osb -> osb_la_resmap , cluster_count ,
12101200 OCFS2_LOCAL_ALLOC (alloc )-> la_bitmap );
12111201
1212- mlog (0 , "New window allocated:\n" );
1213- mlog (0 , "window la_bm_off = %u\n" ,
1214- OCFS2_LOCAL_ALLOC (alloc )-> la_bm_off );
1215- mlog (0 , "window bits = %u\n" , le32_to_cpu (alloc -> id1 .bitmap1 .i_total ));
1202+ trace_ocfs2_local_alloc_new_window_result (
1203+ OCFS2_LOCAL_ALLOC (alloc )-> la_bm_off ,
1204+ le32_to_cpu (alloc -> id1 .bitmap1 .i_total ));
12161205
12171206bail :
12181207 if (status )
0 commit comments