From 1e8aa06db5b056b9c5c67333cdc14557c6ae5a89 Mon Sep 17 00:00:00 2001 From: Albert Chu Date: Tue, 27 Mar 2018 15:46:08 -0700 Subject: [PATCH 1/2] modules/kvs: Remove unnecessary state setting --- src/modules/kvs/lookup.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/kvs/lookup.c b/src/modules/kvs/lookup.c index 3b7069ea1ccd..2179d6d5cfb1 100644 --- a/src/modules/kvs/lookup.c +++ b/src/modules/kvs/lookup.c @@ -876,7 +876,6 @@ lookup_process_t lookup (lookup_t *lh) lh->root_ref, lh->current_epoch)) || !cache_entry_get_valid (entry)) { - lh->state = LOOKUP_STATE_CHECK_ROOT; lh->missing_ref = lh->root_ref; return LOOKUP_PROCESS_LOAD_MISSING_REFS; } From 6629a18a69d1aaab6183bd573e085aa777aa26ca Mon Sep 17 00:00:00 2001 From: Albert Chu Date: Tue, 27 Mar 2018 15:30:04 -0700 Subject: [PATCH 2/2] modules/kvs: Initialize walk at new time Move where the lookup walk() is initialized, so that it is initialized just before beginning a walk(). --- src/modules/kvs/lookup.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/modules/kvs/lookup.c b/src/modules/kvs/lookup.c index 2179d6d5cfb1..25b3bead35e2 100644 --- a/src/modules/kvs/lookup.c +++ b/src/modules/kvs/lookup.c @@ -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, @@ -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: @@ -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: