aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-05-07 13:46:45 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-06-30 10:09:56 -0400
commit0376bde11be5b87c9fd7d6813ac5fd7e1798b1bf (patch)
treee987fcaca66f89e8aae59b780f1310f83b6c9972 /kernel/trace
parentcf2cb0b27116883c23761e974acba5f3bd719d21 (diff)
ftrace: Add ftrace_rec_counter() macro to simplify the code
The ftrace dynamic record has a flags element that also has a counter. Instead of hard coding "rec->flags & ~FTRACE_FL_MASK" all over the place. Use a macro instead. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ftrace.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b867c647e5bc..a58d840305c3 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1592,7 +1592,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
1592 1592
1593 if (inc) { 1593 if (inc) {
1594 rec->flags++; 1594 rec->flags++;
1595 if (FTRACE_WARN_ON((rec->flags & ~FTRACE_FL_MASK) == FTRACE_REF_MAX)) 1595 if (FTRACE_WARN_ON(ftrace_rec_count(rec) == FTRACE_REF_MAX))
1596 return; 1596 return;
1597 /* 1597 /*
1598 * If any ops wants regs saved for this function 1598 * If any ops wants regs saved for this function
@@ -1601,7 +1601,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
1601 if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) 1601 if (ops->flags & FTRACE_OPS_FL_SAVE_REGS)
1602 rec->flags |= FTRACE_FL_REGS; 1602 rec->flags |= FTRACE_FL_REGS;
1603 } else { 1603 } else {
1604 if (FTRACE_WARN_ON((rec->flags & ~FTRACE_FL_MASK) == 0)) 1604 if (FTRACE_WARN_ON(ftrace_rec_count(rec) == 0))
1605 return; 1605 return;
1606 rec->flags--; 1606 rec->flags--;
1607 /* 1607 /*
@@ -1610,7 +1610,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
1610 * still any ops for this record that wants regs. 1610 * still any ops for this record that wants regs.
1611 * If not, we can stop recording them. 1611 * If not, we can stop recording them.
1612 */ 1612 */
1613 if ((rec->flags & ~FTRACE_FL_MASK) > 0 && 1613 if (ftrace_rec_count(rec) > 0 &&
1614 rec->flags & FTRACE_FL_REGS && 1614 rec->flags & FTRACE_FL_REGS &&
1615 ops->flags & FTRACE_OPS_FL_SAVE_REGS) { 1615 ops->flags & FTRACE_OPS_FL_SAVE_REGS) {
1616 if (!test_rec_ops_needs_regs(rec)) 1616 if (!test_rec_ops_needs_regs(rec))
@@ -1700,7 +1700,7 @@ static int ftrace_check_record(struct dyn_ftrace *rec, int enable, int update)
1700 * If we are disabling calls, then disable all records that 1700 * If we are disabling calls, then disable all records that
1701 * are enabled. 1701 * are enabled.
1702 */ 1702 */
1703 if (enable && (rec->flags & ~FTRACE_FL_MASK)) 1703 if (enable && ftrace_rec_count(rec))
1704 flag = FTRACE_FL_ENABLED; 1704 flag = FTRACE_FL_ENABLED;
1705 1705
1706 /* 1706 /*
@@ -1746,7 +1746,7 @@ static int ftrace_check_record(struct dyn_ftrace *rec, int enable, int update)
1746 1746
1747 if (update) { 1747 if (update) {
1748 /* If there's no more users, clear all flags */ 1748 /* If there's no more users, clear all flags */
1749 if (!(rec->flags & ~FTRACE_FL_MASK)) 1749 if (!ftrace_rec_count(rec))
1750 rec->flags = 0; 1750 rec->flags = 0;
1751 else 1751 else
1752 /* Just disable the record (keep REGS state) */ 1752 /* Just disable the record (keep REGS state) */
@@ -2685,7 +2685,7 @@ static int t_show(struct seq_file *m, void *v)
2685 seq_printf(m, "%ps", (void *)rec->ip); 2685 seq_printf(m, "%ps", (void *)rec->ip);
2686 if (iter->flags & FTRACE_ITER_ENABLED) 2686 if (iter->flags & FTRACE_ITER_ENABLED)
2687 seq_printf(m, " (%ld)%s", 2687 seq_printf(m, " (%ld)%s",
2688 rec->flags & ~FTRACE_FL_MASK, 2688 ftrace_rec_count(rec),
2689 rec->flags & FTRACE_FL_REGS ? " R" : ""); 2689 rec->flags & FTRACE_FL_REGS ? " R" : "");
2690 seq_printf(m, "\n"); 2690 seq_printf(m, "\n");
2691 2691