Skip to content

Commit

Permalink
modules/kvs: Initialize walk at new time
Browse files Browse the repository at this point in the history
Move where the lookup walk() is initialized, so that it is initialized
just before beginning a walk().
  • Loading branch information
chu11 committed Mar 30, 2018
1 parent 1e8aa06 commit 6629a18
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/modules/kvs/lookup.c
Expand Up @@ -104,6 +104,7 @@ struct lookup {
LOOKUP_STATE_INIT,
LOOKUP_STATE_CHECK_NAMESPACE,
LOOKUP_STATE_CHECK_ROOT,
LOOKUP_STATE_WALK_INIT,
LOOKUP_STATE_WALK,
LOOKUP_STATE_VALUE,
LOOKUP_STATE_FINISHED,
Expand Down Expand Up @@ -840,17 +841,6 @@ lookup_process_t lookup (lookup_t *lh)
}
}

if (!(lh->root_dirent = treeobj_create_dirref (lh->root_ref))) {
lh->errnum = errno;
goto error;
}

/* initialize walk - first depth is level 0 */
if (!walk_levels_push (lh, lh->path, 0)) {
lh->errnum = errno;
goto error;
}

lh->state = LOOKUP_STATE_CHECK_ROOT;
/* fallthrough */
case LOOKUP_STATE_CHECK_ROOT:
Expand Down Expand Up @@ -898,6 +888,21 @@ lookup_process_t lookup (lookup_t *lh)
goto done;
}

lh->state = LOOKUP_STATE_WALK_INIT;
/* fallthrough */
case LOOKUP_STATE_WALK_INIT:
/* initialize walk - first depth is level 0 */

if (!(lh->root_dirent = treeobj_create_dirref (lh->root_ref))) {
lh->errnum = errno;
goto error;
}

if (!walk_levels_push (lh, lh->path, 0)) {
lh->errnum = errno;
goto error;
}

lh->state = LOOKUP_STATE_WALK;
/* fallthrough */
case LOOKUP_STATE_WALK:
Expand Down

0 comments on commit 6629a18

Please sign in to comment.