lkml.org 
[lkml]   [2011]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 09/20] tracing/filter: Change count_leafs function to use walk_pred_tree
    From: Jiri Olsa <jolsa@redhat.com>

    Changing count_leafs function to use unified predicates tree
    processing.

    Signed-off-by: Jiri Olsa <jolsa@redhat.com>
    Link: http://lkml.kernel.org/r/1313072754-4620-7-git-send-email-jolsa@redhat.com
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    ---
    kernel/trace/trace_events_filter.c | 47 ++++++++++-------------------------
    1 files changed, 14 insertions(+), 33 deletions(-)

    diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
    index 5b889d4..ebbb261 100644
    --- a/kernel/trace/trace_events_filter.c
    +++ b/kernel/trace/trace_events_filter.c
    @@ -1418,43 +1418,24 @@ static int check_pred_tree(struct event_filter *filter,
    check_pred_tree_cb, &data);
    }

    -static int count_leafs(struct filter_pred *preds, struct filter_pred *root)
    +static int count_leafs_cb(enum move_type move, struct filter_pred *pred,
    + int *err, void *data)
    {
    - struct filter_pred *pred;
    - enum move_type move = MOVE_DOWN;
    - int count = 0;
    - int done = 0;
    + int *count = data;

    - pred = root;
    + if ((move == MOVE_DOWN) &&
    + (pred->left == FILTER_PRED_INVALID))
    + (*count)++;

    - do {
    - switch (move) {
    - case MOVE_DOWN:
    - 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)
    - return 1;
    - count++;
    - 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 WALK_PRED_DEFAULT;
    +}
    +
    +static int count_leafs(struct filter_pred *preds, struct filter_pred *root)
    +{
    + int count = 0, ret;

    + ret = walk_pred_tree(preds, root, count_leafs_cb, &count);
    + WARN_ON(ret);
    return count;
    }

    --
    1.7.6.3

    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2011-10-10 15:47    [W:0.028 / U:0.296 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site