Skip to content
Permalink
Browse files

modules/barrier: rename hopcount to internal

"hopcount" is no longer used as an actual count of hops.  Rename
to "internal" as a flag indicating if a message came from a client
or a downstream barrier.
  • Loading branch information...
chu11 committed Nov 1, 2016
1 parent 69370a5 commit 5e44d20399bc8996e219ef0f4ab49420653a9a02
Showing with 10 additions and 9 deletions.
  1. +7 −7 src/modules/barrier/barrier.c
  2. +3 −2 src/modules/barrier/libbarrier.c
@@ -168,11 +168,11 @@ static void send_enter_request (ctx_t *ctx, barrier_t *b)
flux_rpc_t *rpc;

if (!(rpc = flux_rpcf (ctx->h, "barrier.enter", FLUX_NODEID_UPSTREAM,
FLUX_RPC_NORESPONSE, "{s:s s:i s:i s:i}",
FLUX_RPC_NORESPONSE, "{s:s s:i s:i s:b}",
"name", b->name,
"count", b->count,
"nprocs", b->nprocs,
"hopcount", 1))) {
"internal", true))) {
flux_log_error (ctx->h, "sending barrier.enter request");
goto done;
}
@@ -209,13 +209,13 @@ static void enter_request_cb (flux_t *h, flux_msg_handler_t *w,
barrier_t *b;
char *sender = NULL;
const char *name;
int count, nprocs, hopcount = 0;
int count, nprocs, internal;

if (flux_request_decodef (msg, NULL, "{s:s s:i s:i s:i !}",
if (flux_request_decodef (msg, NULL, "{s:s s:i s:i s:b !}",
"name", &name,
"count", &count,
"nprocs", &nprocs,
"hopcount", &hopcount) < 0
"internal", &internal) < 0
|| flux_msg_get_route_first (msg, &sender) < 0) {
flux_log_error (ctx->h, "%s: decoding request", __FUNCTION__);
goto done;
@@ -225,9 +225,9 @@ static void enter_request_cb (flux_t *h, flux_msg_handler_t *w,
b = barrier_create (ctx, name, nprocs);

/* Distinguish client (tracked) vs downstream barrier plugin (untracked).
* A client, distinguished by hopcount == 0, can only enter barrier once.
* A client, distinguished by internal == false, can only enter barrier once.
*/
if (hopcount == 0) {
if (internal == false) {
if (barrier_add_client (b, sender, msg) < 0) {
flux_respond (ctx->h, msg, EEXIST, NULL);
flux_log (ctx->h, LOG_ERR,
@@ -26,6 +26,7 @@
#include "config.h"
#endif
#include <flux/core.h>
#include <stdbool.h>

#include "src/common/libutil/xzmalloc.h"

@@ -69,11 +70,11 @@ int flux_barrier (flux_t *h, const char *name, int nprocs)
name = s = xasprintf ("%s%d", ctx->id, ctx->seq++);
}
if (!(rpc = flux_rpcf (h, "barrier.enter", FLUX_NODEID_ANY, 0,
"{s:s s:i s:i s:i}",
"{s:s s:i s:i s:b}",
"name", name,
"count", 1,
"nprocs", nprocs,
"hopcount", 0)))
"internal", false)))
goto done;
if (flux_rpc_get (rpc, NULL) < 0)
goto done;

0 comments on commit 5e44d20

Please sign in to comment.
You can’t perform that action at this time.