[PATCH 2/5] ftrace: Comment __ftrace_hash_rec_update() and make filter_hash bool

From: Steven Rostedt
Date: Tue Jun 04 2024 - 17:29:03 EST


From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

The function __ftrace_hash_rec_update() parameter "filter_hash" is only
used for true or false (boolean), but is of type int. It already has an
"inc" parameter that is boolean. This is confusing, make "filter_hash"
boolean as well.

While at it, add some documentation to that function especially since it
holds the guts of the filtering logic of ftrace.

Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
kernel/trace/ftrace.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 9dcdefe9d1aa..93c7c5fd4249 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1701,8 +1701,20 @@ static bool skip_record(struct dyn_ftrace *rec)
!(rec->flags & FTRACE_FL_ENABLED);
}

+/*
+ * This is the main engine to the ftrace updates.
+ *
+ * It will iterate through all the available ftrace functions
+ * (the ones that ftrace can have callbacks to) and set the flags
+ * to the associated dyn_ftrace records.
+ *
+ * @filter_hash: True if for the filter hash is udpated, false for the
+ * notrace hash
+ * @inc: True to add this hash, false to remove it (increment the
+ * recorder counters or decrement them).
+ */
static bool __ftrace_hash_rec_update(struct ftrace_ops *ops,
- int filter_hash,
+ bool filter_hash,
bool inc)
{
struct ftrace_hash *hash;
--
2.43.0