lkml.org 
[lkml]   [2011]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 09/10] tracing/filter: Change filter_match_preds function to use walk_pred_tree
From
Date
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@redhat.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);
> + }




\
 
 \ /
  Last update: 2011-08-10 23:17    [W:0.062 / U:22.428 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site