Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269070
b: refs/heads/master
c: 1b797fe
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Olsa authored and Steven Rostedt committed Aug 19, 2011
1 parent cd4d79d commit fc7d890
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c00b060f36e1238816ebcf2c8cccd5e9fa068980
refs/heads/master: 1b797fe5aaac11e60fce1592119d0517e95aba95
65 changes: 20 additions & 45 deletions trunk/kernel/trace/trace_events_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,24 @@ static int fold_pred(struct filter_pred *preds, struct filter_pred *root)
return 0;
}

static int fold_pred_tree_cb(enum move_type move, struct filter_pred *pred,
int *err, void *data)
{
struct filter_pred *preds = data;

if (move != MOVE_DOWN)
return WALK_PRED_DEFAULT;
if (!(pred->index & FILTER_PRED_FOLD))
return WALK_PRED_DEFAULT;

*err = fold_pred(preds, pred);
if (*err)
return WALK_PRED_ABORT;

/* eveyrhing below is folded, continue with parent */
return WALK_PRED_PARENT;
}

/*
* To optimize the processing of the ops, if we have several "ors" or
* "ands" together, we can put them in an array and process them all
Expand All @@ -1504,51 +1522,8 @@ static int fold_pred(struct filter_pred *preds, struct filter_pred *root)
static int fold_pred_tree(struct event_filter *filter,
struct filter_pred *root)
{
struct filter_pred *preds;
struct filter_pred *pred;
enum move_type move = MOVE_DOWN;
int done = 0;
int err;

preds = filter->preds;
if (!preds)
return -EINVAL;
pred = root;

do {
switch (move) {
case MOVE_DOWN:
if (pred->index & FILTER_PRED_FOLD) {
err = fold_pred(preds, pred);
if (err)
return err;
/* Folded nodes are like leafs */
} else if (pred->left != FILTER_PRED_INVALID) {
pred = &preds[pred->left];
continue;
}

/* A leaf at the root is just a leaf in the tree */
if (pred == root)
break;
pred = get_pred_parent(pred, preds,
pred->parent, &move);
continue;
case MOVE_UP_FROM_LEFT:
pred = &preds[pred->right];
move = MOVE_DOWN;
continue;
case MOVE_UP_FROM_RIGHT:
if (pred == root)
break;
pred = get_pred_parent(pred, preds,
pred->parent, &move);
continue;
}
done = 1;
} while (!done);

return 0;
return walk_pred_tree(filter->preds, root, fold_pred_tree_cb,
filter->preds);
}

static int replace_preds(struct ftrace_event_call *call,
Expand Down

0 comments on commit fc7d890

Please sign in to comment.