Skip to content

Commit

Permalink
[host] move dst cache updates to the right logging subsystem
Browse files Browse the repository at this point in the history
and return error codes

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
  • Loading branch information
fabbione committed Mar 19, 2015
1 parent f5e79cd commit 0ee5973
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions libknet/host.c
Expand Up @@ -557,7 +557,7 @@ static void _clear_cbuffers(struct knet_host *host)
host->ucast_seq_num_rx = 0;
}

void _host_dstcache_update_sync(knet_handle_t knet_h, struct knet_host *host)
int _host_dstcache_update_sync(knet_handle_t knet_h, struct knet_host *host)
{
int link_idx;
int best_priority = -1;
Expand All @@ -567,8 +567,8 @@ void _host_dstcache_update_sync(knet_handle_t knet_h, struct knet_host *host)
int host_has_remote = 0;

if (pthread_mutex_lock(&host->active_links_mutex) != 0) {
log_debug(knet_h, KNET_SUB_SWITCH_T, "Unable to get active links mutex!");
return;
log_debug(knet_h, KNET_SUB_HOST, "Unable to get active links mutex!");
return -1;
}

host->active_link_entries = 0;
Expand Down Expand Up @@ -608,24 +608,24 @@ void _host_dstcache_update_sync(knet_handle_t knet_h, struct knet_host *host)
}

if (host->link_handler_policy == KNET_LINK_POLICY_PASSIVE) {
log_debug(knet_h, KNET_SUB_SWITCH_T, "host: %u (passive) best link: %u (pri: %u)",
log_debug(knet_h, KNET_SUB_HOST, "host: %u (passive) best link: %u (pri: %u)",
host->host_id, host->link[host->active_links[0]].link_id,
host->link[host->active_links[0]].priority);
} else {
log_debug(knet_h, KNET_SUB_SWITCH_T, "host: %u has %u active links",
log_debug(knet_h, KNET_SUB_HOST, "host: %u has %u active links",
host->host_id, host->active_link_entries);
}

/* no active links, we can clean the circular buffers and indexes */
if ((!host->active_link_entries) || (clear_cbuffer) || (!host_has_remote)) {
if (!host_has_remote) {
log_debug(knet_h, KNET_SUB_SWITCH_T, "host: %u has no active remote links", host->host_id);
log_debug(knet_h, KNET_SUB_HOST, "host: %u has no active remote links", host->host_id);
}
if (!host->active_link_entries) {
log_warn(knet_h, KNET_SUB_SWITCH_T, "host: %u has no active links", host->host_id);
log_warn(knet_h, KNET_SUB_HOST, "host: %u has no active links", host->host_id);
}
if (clear_cbuffer) {
log_debug(knet_h, KNET_SUB_SWITCH_T, "host: %u is coming back to life", host->host_id);
log_debug(knet_h, KNET_SUB_HOST, "host: %u is coming back to life", host->host_id);
}
_clear_cbuffers(host);
}
Expand All @@ -648,4 +648,6 @@ void _host_dstcache_update_sync(knet_handle_t knet_h, struct knet_host *host)
host->link[send_link_status[i]].donnotremoteupdate = 0;
}
}

return 0;
}
2 changes: 1 addition & 1 deletion libknet/host.h
Expand Up @@ -16,6 +16,6 @@ int _should_deliver(struct knet_host *host, int bcast, seq_num_t seq_num);
void _has_been_delivered(struct knet_host *host, int bcast, seq_num_t seq_num);
int _send_host_info(knet_handle_t knet_h, const void *data, const size_t datalen);
int _host_dstcache_update_async(knet_handle_t knet_h, struct knet_host *host);
void _host_dstcache_update_sync(knet_handle_t knet_h, struct knet_host *host);
int _host_dstcache_update_sync(knet_handle_t knet_h, struct knet_host *host);

#endif

0 comments on commit 0ee5973

Please sign in to comment.