aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/localalloc.c
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2011-02-21 18:56:45 -0500
committerTao Ma <boyu.mt@taobao.com>2011-02-21 18:56:45 -0500
commita04733d8afad9cd0bfb8269173e30d28fb96088e (patch)
tree4880e40a4034d2c2c742ae243533bc9b9f9c33bd /fs/ocfs2/localalloc.c
parenta09d09b8f8d7c8acd46d96e3e9899bd1461fc036 (diff)
ocfs2: Remove mlog(0) from fs/ocfs2/localalloc.c
This is the 2nd step to remove the debug info of DISK_ALLOC. So this patch removes all mlog(0,...) from localalloc.c and adds the corresponding tracepoints. Different mlogs have different solutions. 1. Some are replaced with trace event directly. 2. Some are replaced while some new parameters are added. 3. Some are combined into one trace events. 4. Some redundant mlogs are removed. Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Diffstat (limited to 'fs/ocfs2/localalloc.c')
-rw-r--r--fs/ocfs2/localalloc.c57
1 files changed, 23 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)