[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1313010869.18583.274.camel@gandalf.stny.rr.com>
Date: Wed, 10 Aug 2011 17:14:29 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: fweisbec@...il.com, mingo@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 09/10] tracing/filter: Change filter_match_preds
function to use walk_pred_tree
On Thu, 2011-08-04 at 12:08 +0200, Jiri Olsa wrote:
> Changing filter_match_preds function to use unified predicates tree
> processing.
>
> Signed-off-by: Jiri Olsa <jolsa@...hat.com>
> ---
> kernel/trace/trace_events_filter.c | 119 +++++++++++++++++-------------------
> 1 files changed, 55 insertions(+), 64 deletions(-)
>
> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index d4e0c09..55b13b9 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c
> @@ -467,6 +467,7 @@ static int process_ops(struct filter_pred *preds,
>
> for (i = 0; i < op->val; i++) {
> pred = &preds[op->ops[i]];
> + BUG_ON(!pred->fn);
Why the added BUG_ON()s? Do we really need to crash the kernel on error
here?
-- Steve
> match = pred->fn(pred, rec);
> if (!!match == type)
> return match;
> @@ -474,92 +475,82 @@ static int process_ops(struct filter_pred *preds,
> return match;
> }
>
> +struct filter_match_preds_data {
> + struct filter_pred *preds;
> + int match;
> + void *rec;
> +};
> +
> +static int filter_match_preds_cb(enum move_type move, struct filter_pred *pred,
> + int *err, void *data)
> +{
> + struct filter_match_preds_data *d = data;
> +
> + *err = 0;
> + switch (move) {
> + case MOVE_DOWN:
> + /* only AND and OR have children */
> + if (pred->left != FILTER_PRED_INVALID) {
> + /* If ops is set, then it was folded. */
> + if (!pred->ops)
> + return WALK_PRED_DEFAULT;
> + /* We can treat folded ops as a leaf node */
> + d->match = process_ops(d->preds, pred, d->rec);
> + } else {
> + BUG_ON(!pred->fn);
> + d->match = pred->fn(pred, d->rec);
> + }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists