Commit a04733d8 authored by Tao Ma's avatar Tao Ma

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: default avatarTao Ma <boyu.mt@taobao.com>
parent a09d09b8
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "suballoc.h" #include "suballoc.h"
#include "super.h" #include "super.h"
#include "sysfile.h" #include "sysfile.h"
#include "ocfs2_trace.h"
#include "buffer_head_io.h" #include "buffer_head_io.h"
...@@ -201,8 +202,7 @@ void ocfs2_la_set_sizes(struct ocfs2_super *osb, int requested_mb) ...@@ -201,8 +202,7 @@ void ocfs2_la_set_sizes(struct ocfs2_super *osb, int requested_mb)
la_max_mb = ocfs2_clusters_to_megabytes(sb, la_max_mb = ocfs2_clusters_to_megabytes(sb,
ocfs2_local_alloc_size(sb) * 8); ocfs2_local_alloc_size(sb) * 8);
mlog(0, "requested: %dM, max: %uM, default: %uM\n", trace_ocfs2_la_set_sizes(requested_mb, la_max_mb, la_default_mb);
requested_mb, la_max_mb, la_default_mb);
if (requested_mb == -1) { if (requested_mb == -1) {
/* No user request - use defaults */ /* No user request - use defaults */
...@@ -276,8 +276,8 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits) ...@@ -276,8 +276,8 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits)
ret = 1; ret = 1;
bail: bail:
mlog(0, "state=%d, bits=%llu, la_bits=%d, ret=%d\n", trace_ocfs2_alloc_should_use_local(
osb->local_alloc_state, (unsigned long long)bits, la_bits, ret); (unsigned long long)bits, osb->local_alloc_state, la_bits, ret);
spin_unlock(&osb->osb_lock); spin_unlock(&osb->osb_lock);
return ret; return ret;
} }
...@@ -362,7 +362,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb) ...@@ -362,7 +362,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
if (inode) if (inode)
iput(inode); iput(inode);
mlog(0, "Local alloc window bits = %d\n", osb->local_alloc_bits); trace_ocfs2_load_local_alloc(osb->local_alloc_bits);
if (status) if (status)
mlog_errno(status); mlog_errno(status);
...@@ -497,7 +497,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb, ...@@ -497,7 +497,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
struct inode *inode = NULL; struct inode *inode = NULL;
struct ocfs2_dinode *alloc; struct ocfs2_dinode *alloc;
mlog(0, "(slot_num = %d)\n", slot_num); trace_ocfs2_begin_local_alloc_recovery(slot_num);
*alloc_copy = NULL; *alloc_copy = NULL;
...@@ -705,10 +705,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, ...@@ -705,10 +705,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
goto bail; goto bail;
} }
if (ac->ac_max_block)
mlog(0, "Calling in_range for max block %llu\n",
(unsigned long long)ac->ac_max_block);
ac->ac_inode = local_alloc_inode; ac->ac_inode = local_alloc_inode;
/* We should never use localalloc from another slot */ /* We should never use localalloc from another slot */
ac->ac_alloc_slot = osb->slot_num; ac->ac_alloc_slot = osb->slot_num;
...@@ -722,8 +718,9 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, ...@@ -722,8 +718,9 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
iput(local_alloc_inode); iput(local_alloc_inode);
} }
mlog(0, "bits=%d, slot=%d, ret=%d\n", bits_wanted, osb->slot_num, trace_ocfs2_reserve_local_alloc_bits(
status); (unsigned long long)ac->ac_max_block,
bits_wanted, osb->slot_num, status);
if (status) if (status)
mlog_errno(status); mlog_errno(status);
...@@ -797,7 +794,7 @@ static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc) ...@@ -797,7 +794,7 @@ static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
for (i = 0; i < le16_to_cpu(la->la_size); i++) for (i = 0; i < le16_to_cpu(la->la_size); i++)
count += hweight8(buffer[i]); count += hweight8(buffer[i]);
mlog(0, "count %u\n", count); trace_ocfs2_local_alloc_count_bits(count);
return count; return count;
} }
...@@ -812,10 +809,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb, ...@@ -812,10 +809,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
void *bitmap = NULL; void *bitmap = NULL;
struct ocfs2_reservation_map *resmap = &osb->osb_la_resmap; struct ocfs2_reservation_map *resmap = &osb->osb_la_resmap;
mlog(0, "(numbits wanted = %u)\n", *numbits);
if (!alloc->id1.bitmap1.i_total) { if (!alloc->id1.bitmap1.i_total) {
mlog(0, "No bits in my window!\n");
bitoff = -1; bitoff = -1;
goto bail; goto bail;
} }
...@@ -875,8 +869,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb, ...@@ -875,8 +869,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
} }
} }
mlog(0, "Exiting loop, bitoff = %d, numfound = %d\n", bitoff, trace_ocfs2_local_alloc_find_clear_bits_search_bitmap(bitoff, numfound);
numfound);
if (numfound == *numbits) if (numfound == *numbits)
bitoff = startoff - numfound; bitoff = startoff - numfound;
...@@ -887,7 +880,10 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb, ...@@ -887,7 +880,10 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb,
if (local_resv) if (local_resv)
ocfs2_resv_discard(resmap, resv); ocfs2_resv_discard(resmap, resv);
mlog(0, "bitoff %d\n", bitoff); trace_ocfs2_local_alloc_find_clear_bits(*numbits,
le32_to_cpu(alloc->id1.bitmap1.i_total),
bitoff, numfound);
return bitoff; return bitoff;
} }
...@@ -941,18 +937,16 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, ...@@ -941,18 +937,16 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
void *bitmap; void *bitmap;
struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
mlog(0, "total = %u, used = %u\n", trace_ocfs2_sync_local_to_main(
le32_to_cpu(alloc->id1.bitmap1.i_total), le32_to_cpu(alloc->id1.bitmap1.i_total),
le32_to_cpu(alloc->id1.bitmap1.i_used)); le32_to_cpu(alloc->id1.bitmap1.i_used));
if (!alloc->id1.bitmap1.i_total) { if (!alloc->id1.bitmap1.i_total) {
mlog(0, "nothing to sync!\n");
goto bail; goto bail;
} }
if (le32_to_cpu(alloc->id1.bitmap1.i_used) == if (le32_to_cpu(alloc->id1.bitmap1.i_used) ==
le32_to_cpu(alloc->id1.bitmap1.i_total)) { le32_to_cpu(alloc->id1.bitmap1.i_total)) {
mlog(0, "all bits were taken!\n");
goto bail; goto bail;
} }
...@@ -974,8 +968,7 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, ...@@ -974,8 +968,7 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
ocfs2_clusters_to_blocks(osb->sb, ocfs2_clusters_to_blocks(osb->sb,
start - count); start - count);
mlog(0, "freeing %u bits starting at local alloc bit " trace_ocfs2_sync_local_to_main_free(
"%u (la_start_blk = %llu, blkno = %llu)\n",
count, start - count, count, start - count,
(unsigned long long)la_start_blk, (unsigned long long)la_start_blk,
(unsigned long long)blkno); (unsigned long long)blkno);
...@@ -1142,12 +1135,9 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, ...@@ -1142,12 +1135,9 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
la = OCFS2_LOCAL_ALLOC(alloc); la = OCFS2_LOCAL_ALLOC(alloc);
if (alloc->id1.bitmap1.i_total) trace_ocfs2_local_alloc_new_window(
mlog(0, "asking me to alloc a new window over a non-empty " le32_to_cpu(alloc->id1.bitmap1.i_total),
"one\n"); osb->local_alloc_bits);
mlog(0, "Allocating %u clusters for a new window.\n",
osb->local_alloc_bits);
/* Instruct the allocation code to try the most recently used /* Instruct the allocation code to try the most recently used
* cluster group. We'll re-record the group used this pass * 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, ...@@ -1209,10 +1199,9 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb,
ocfs2_resmap_restart(&osb->osb_la_resmap, cluster_count, ocfs2_resmap_restart(&osb->osb_la_resmap, cluster_count,
OCFS2_LOCAL_ALLOC(alloc)->la_bitmap); OCFS2_LOCAL_ALLOC(alloc)->la_bitmap);
mlog(0, "New window allocated:\n"); trace_ocfs2_local_alloc_new_window_result(
mlog(0, "window la_bm_off = %u\n", OCFS2_LOCAL_ALLOC(alloc)->la_bm_off,
OCFS2_LOCAL_ALLOC(alloc)->la_bm_off); le32_to_cpu(alloc->id1.bitmap1.i_total));
mlog(0, "window bits = %u\n", le32_to_cpu(alloc->id1.bitmap1.i_total));
bail: bail:
if (status) if (status)
......
...@@ -23,6 +23,23 @@ DEFINE_EVENT(ocfs2__int, name, \ ...@@ -23,6 +23,23 @@ DEFINE_EVENT(ocfs2__int, name, \
TP_PROTO(int num), \ TP_PROTO(int num), \
TP_ARGS(num)) TP_ARGS(num))
DECLARE_EVENT_CLASS(ocfs2__uint,
TP_PROTO(unsigned int num),
TP_ARGS(num),
TP_STRUCT__entry(
__field( unsigned int, num )
),
TP_fast_assign(
__entry->num = num;
),
TP_printk("%u", __entry->num)
);
#define DEFINE_OCFS2_UINT_EVENT(name) \
DEFINE_EVENT(ocfs2__uint, name, \
TP_PROTO(unsigned int num), \
TP_ARGS(num))
DECLARE_EVENT_CLASS(ocfs2__int_int, DECLARE_EVENT_CLASS(ocfs2__int_int,
TP_PROTO(int value1, int value2), TP_PROTO(int value1, int value2),
TP_ARGS(value1, value2), TP_ARGS(value1, value2),
...@@ -61,6 +78,55 @@ DEFINE_EVENT(ocfs2__ull_uint, name, \ ...@@ -61,6 +78,55 @@ DEFINE_EVENT(ocfs2__ull_uint, name, \
TP_PROTO(unsigned long long val1, unsigned int val2), \ TP_PROTO(unsigned long long val1, unsigned int val2), \
TP_ARGS(val1, val2)) TP_ARGS(val1, val2))
DECLARE_EVENT_CLASS(ocfs2__uint_uint_uint,
TP_PROTO(unsigned int value1, unsigned int value2,
unsigned int value3),
TP_ARGS(value1, value2, value3),
TP_STRUCT__entry(
__field( unsigned int, value1 )
__field( unsigned int, value2 )
__field( unsigned int, value3 )
),
TP_fast_assign(
__entry->value1 = value1;
__entry->value2 = value2;
__entry->value3 = value3;
),
TP_printk("%u %u %u", __entry->value1, __entry->value2, __entry->value3)
);
#define DEFINE_OCFS2_UINT_UINT_UINT_EVENT(name) \
DEFINE_EVENT(ocfs2__uint_uint_uint, name, \
TP_PROTO(unsigned int value1, unsigned int value2, \
unsigned int value3), \
TP_ARGS(value1, value2, value3))
DECLARE_EVENT_CLASS(ocfs2__ull_int_int_int,
TP_PROTO(unsigned long long ull, int value1, int value2, int value3),
TP_ARGS(ull, value1, value2, value3),
TP_STRUCT__entry(
__field( unsigned long long, ull )
__field( int, value1 )
__field( int, value2 )
__field( int, value3 )
),
TP_fast_assign(
__entry->ull = ull;
__entry->value1 = value1;
__entry->value2 = value2;
__entry->value3 = value3;
),
TP_printk("%llu %d %d %d",
__entry->ull, __entry->value1,
__entry->value2, __entry->value3)
);
#define DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(name) \
DEFINE_EVENT(ocfs2__ull_int_int_int, name, \
TP_PROTO(unsigned long long ull, int value1, \
int value2, int value3), \
TP_ARGS(ull, value1, value2, value3))
/* Trace events for fs/ocfs2/alloc.c. */ /* Trace events for fs/ocfs2/alloc.c. */
DECLARE_EVENT_CLASS(ocfs2__btree_ops, DECLARE_EVENT_CLASS(ocfs2__btree_ops,
TP_PROTO(unsigned long long owner,\ TP_PROTO(unsigned long long owner,\
...@@ -371,6 +437,52 @@ TRACE_EVENT(ocfs2_cache_block_dealloc, ...@@ -371,6 +437,52 @@ TRACE_EVENT(ocfs2_cache_block_dealloc,
/* End of trace events for fs/ocfs2/alloc.c. */ /* End of trace events for fs/ocfs2/alloc.c. */
/* Trace events for fs/ocfs2/localalloc.c. */
DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_la_set_sizes);
DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_alloc_should_use_local);
DEFINE_OCFS2_INT_EVENT(ocfs2_load_local_alloc);
DEFINE_OCFS2_INT_EVENT(ocfs2_begin_local_alloc_recovery);
DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_reserve_local_alloc_bits);
DEFINE_OCFS2_UINT_EVENT(ocfs2_local_alloc_count_bits);
DEFINE_OCFS2_INT_INT_EVENT(ocfs2_local_alloc_find_clear_bits_search_bitmap);
DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_local_alloc_find_clear_bits);
DEFINE_OCFS2_INT_INT_EVENT(ocfs2_sync_local_to_main);
TRACE_EVENT(ocfs2_sync_local_to_main_free,
TP_PROTO(int count, int bit, unsigned long long start_blk,
unsigned long long blkno),
TP_ARGS(count, bit, start_blk, blkno),
TP_STRUCT__entry(
__field(int, count)
__field(int, bit)
__field(unsigned long long, start_blk)
__field(unsigned long long, blkno)
),
TP_fast_assign(
__entry->count = count;
__entry->bit = bit;
__entry->start_blk = start_blk;
__entry->blkno = blkno;
),
TP_printk("%d %d %llu %llu",
__entry->count, __entry->bit, __entry->start_blk,
__entry->blkno)
);
DEFINE_OCFS2_INT_INT_EVENT(ocfs2_local_alloc_new_window);
DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_local_alloc_new_window_result);
/* End of trace events for fs/ocfs2/localalloc.c. */
#endif /* _TRACE_OCFS2_H */ #endif /* _TRACE_OCFS2_H */
/* This part must be outside protection */ /* This part must be outside protection */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment