Skip to content

Commit 7e65c3f

Browse files
committed
avoid bcast and send of extent cache
1 parent b53a4d3 commit 7e65c3f

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

server/src/unifyfs_group_rpc.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,20 +1270,20 @@ int unifyfs_invoke_broadcast_extents_cache(int gfid)
12701270
hg_id_t op_hgid = unifyfsd_rpc_context->rpcs.extent_cache_bcast_id;
12711271
hg_size_t buf_size = n_extents * sizeof(*extents);
12721272
hg_bulk_t extents_bulk;
1273-
//void* buf = (void*) extents;
1273+
void* buf = (void*) extents;
12741274
// MJB TESTING: make a copy to avoid reuse of cache as bulk across
12751275
// concurrent bcasts
1276-
void* buf = malloc((size_t)buf_size);
1277-
if (NULL != buf) {
1278-
memcpy(buf, (void*)extents, (size_t)buf_size);
1276+
//void* buf = malloc((size_t)buf_size);
1277+
//if (NULL != buf) {
1278+
//memcpy(buf, (void*)extents, (size_t)buf_size);
12791279
hg_return_t hret = margo_bulk_create(unifyfsd_rpc_context->svr_mid, 1,
12801280
&buf, &buf_size,
12811281
HG_BULK_READ_ONLY, &extents_bulk);
12821282
if (hret != HG_SUCCESS) {
12831283
LOGERR("margo_bulk_create() failed - %s",
12841284
HG_Error_to_string(hret));
12851285
ret = UNIFYFS_ERROR_MARGO;
1286-
free(buf);
1286+
//free(buf);
12871287
} else {
12881288
coll_request* coll = NULL;
12891289
extent_cache_bcast_in_t* in = calloc(1, sizeof(*in));
@@ -1301,18 +1301,27 @@ int unifyfs_invoke_broadcast_extents_cache(int gfid)
13011301
coll = collective_create(rpc, HG_HANDLE_NULL, op_hgid,
13021302
glb_pmi_rank, (void*)in, NULL,
13031303
sizeof(extent_cache_bcast_out_t),
1304-
HG_BULK_NULL, extents_bulk, buf);
1304+
HG_BULK_NULL, extents_bulk, NULL//buf
1305+
);
13051306
if (NULL == coll) {
13061307
ret = ENOMEM;
13071308
} else {
1309+
/* start the broadcast */
13081310
ret = collective_forward(coll);
13091311
if (ret == UNIFYFS_SUCCESS) {
1310-
ret = invoke_bcast_progress_rpc(coll);
1312+
/* progress/finish the bcast operation */
1313+
LOGDBG("BCAST_RPC: bcast progress collective(%p)",
1314+
coll);
1315+
ret = collective_finish(coll);
1316+
if (ret != UNIFYFS_SUCCESS) {
1317+
LOGERR("finish failed for coll(%p) (rc=%d)",
1318+
coll, ret);
1319+
}
13111320
}
13121321
}
13131322
}
13141323
}
1315-
}
1324+
//}
13161325

13171326
return ret;
13181327
}

server/src/unifyfs_p2p_rpc.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,8 @@ int unifyfs_invoke_get_extents_rpc(int gfid,
10561056
return ret;
10571057
}
10581058

1059+
static struct timespec last_cache_bcast = (struct timespec) {0};
1060+
10591061
static void process_get_extents_rpc(server_rpc_req_t* sreq)
10601062
{
10611063
int ret;
@@ -1090,9 +1092,16 @@ static void process_get_extents_rpc(server_rpc_req_t* sreq)
10901092
LOGDBG("owner has newer extents metadata");
10911093
send_extents = 1;
10921094
if (src_stamp.tv_sec == 0) {
1093-
/* source timestamp is zero, time to broadcast */
1094-
LOGDBG("broadcasting extents metadata to cache");
1095-
ret = unifyfs_invoke_broadcast_extents_cache(gfid);
1095+
/* source timestamp is zero, need to broadcast? */
1096+
cmp = compare_timespec(&owner_stamp, &last_cache_bcast);
1097+
if (0 != cmp) {
1098+
last_cache_bcast = owner_stamp;
1099+
LOGDBG("broadcasting extents metadata to cache");
1100+
ret = unifyfs_invoke_broadcast_extents_cache(gfid);
1101+
if (UNIFYFS_SUCCESS == ret) {
1102+
send_extents = 0;
1103+
}
1104+
}
10961105
}
10971106
} else if (-1 == cmp) {
10981107
/* source timestamp is newer, which should not happen.

0 commit comments

Comments
 (0)