Skip to content

Commit

Permalink
Merge pull request #1321 from chu11/kvsrootrefactor
Browse files Browse the repository at this point in the history
kvs: refactor with internal kvsroot file
  • Loading branch information
garlick authored Jan 25, 2018
2 parents c2e368e + 0f9ec32 commit 7969ee6
Show file tree
Hide file tree
Showing 6 changed files with 756 additions and 266 deletions.
19 changes: 17 additions & 2 deletions src/modules/kvs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ kvs_la_SOURCES = \
commit.h \
commit.c \
msg_cb_handler.h \
msg_cb_handler.c
msg_cb_handler.c \
kvsroot.h \
kvsroot.c

kvs_la_LDFLAGS = $(fluxmod_ldflags) -module
kvs_la_LIBADD = $(top_builddir)/src/common/libkvs/libkvs.la \
Expand All @@ -41,7 +43,8 @@ TESTS = \
test_fence.t \
test_commit.t \
test_kvs_util.t \
test_msg_cb_handler.t
test_msg_cb_handler.t \
test_kvsroot.t

test_ldadd = \
$(top_builddir)/src/common/libkvs/libkvs.la \
Expand Down Expand Up @@ -117,3 +120,15 @@ test_msg_cb_handler_t_CPPFLAGS = $(test_cppflags)
test_msg_cb_handler_t_LDADD = \
$(top_builddir)/src/modules/kvs/msg_cb_handler.o \
$(test_ldadd)

test_kvsroot_t_SOURCES = test/kvsroot.c
test_kvsroot_t_CPPFLAGS = $(test_cppflags)
test_kvsroot_t_LDADD = \
$(top_builddir)/src/modules/kvs/kvsroot.o \
$(top_builddir)/src/modules/kvs/waitqueue.o \
$(top_builddir)/src/modules/kvs/commit.o \
$(top_builddir)/src/modules/kvs/cache.o \
$(top_builddir)/src/modules/kvs/fence.o \
$(top_builddir)/src/modules/kvs/msg_cb_handler.o \
$(top_builddir)/src/modules/kvs/kvs_util.o \
$(test_ldadd)
12 changes: 7 additions & 5 deletions src/modules/kvs/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,15 +1019,14 @@ int commit_mgr_iter_not_ready_fences (commit_mgr_t *cm, commit_fence_f cb,
{
fence_t *f;
char *name;
int rc = -1;

cm->iterating_fences = true;

f = zhash_first (cm->fences);
while (f) {
if (!(fence_get_aux_int (f) & FENCE_READY_MASK)) {
if (cb (f, data) < 0)
goto done;
goto error;
}

f = zhash_next (cm->fences);
Expand All @@ -1040,10 +1039,13 @@ int commit_mgr_iter_not_ready_fences (commit_mgr_t *cm, commit_fence_f cb,
free (name);
}

rc = 0;
done:
return 0;

error:
while ((name = zlist_pop (cm->removelist)))
free (name);
cm->iterating_fences = false;
return rc;
return -1;
}

int commit_mgr_process_fence_request (commit_mgr_t *cm, const char *name)
Expand Down
Loading

0 comments on commit 7969ee6

Please sign in to comment.