summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-03-16 09:39:57 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-17 11:57:47 -0700
commit02d8dcbb5c7483ade3dd052d75e6430cb0253d1f (patch)
tree32fefe7cf6324b69a731fd12e4574ab4786b6803 /rpc/rpc-transport
parentd4aae8327ac5581cd47dd0fcea796ddbb03be5ea (diff)
rpc-transport: whitespace cleanup
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2346 (Log message enhancements in GlusterFS - phase 1) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346
Diffstat (limited to 'rpc/rpc-transport')
-rw-r--r--rpc/rpc-transport/rdma/src/name.c150
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c428
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.h4
-rw-r--r--rpc/rpc-transport/socket/src/name.c26
-rw-r--r--rpc/rpc-transport/socket/src/socket.c374
-rw-r--r--rpc/rpc-transport/socket/src/socket.h4
6 files changed, 493 insertions, 493 deletions
diff --git a/rpc/rpc-transport/rdma/src/name.c b/rpc/rpc-transport/rdma/src/name.c
index ae5c5d3562e..3a8ce9d4350 100644
--- a/rpc/rpc-transport/rdma/src/name.c
+++ b/rpc/rpc-transport/rdma/src/name.c
@@ -37,14 +37,14 @@
#include "rdma.h"
int32_t
-gf_resolve_ip6 (const char *hostname,
- uint16_t port,
- int family,
- void **dnscache,
+gf_resolve_ip6 (const char *hostname,
+ uint16_t port,
+ int family,
+ void **dnscache,
struct addrinfo **addr_info);
static int32_t
-af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
+af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
socklen_t sockaddr_len, int ceiling)
{
int32_t ret = -1;
@@ -80,16 +80,16 @@ af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
}
static int32_t
-af_unix_client_bind (rpc_transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t sockaddr_len,
+af_unix_client_bind (rpc_transport_t *this,
+ struct sockaddr *sockaddr,
+ socklen_t sockaddr_len,
int sock)
{
data_t *path_data = NULL;
struct sockaddr_un *addr = NULL;
int32_t ret = -1;
- path_data = dict_get (this->options,
+ path_data = dict_get (this->options,
"transport.rdma.bind-path");
if (path_data) {
char *path = data_to_str (path_data);
@@ -106,7 +106,7 @@ af_unix_client_bind (rpc_transport_t *this,
ret = bind (sock, (struct sockaddr *)addr, sockaddr_len);
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
- "cannot bind to unix-domain socket %d (%s)",
+ "cannot bind to unix-domain socket %d (%s)",
sock, strerror (errno));
goto err;
}
@@ -121,24 +121,24 @@ client_fill_address_family (rpc_transport_t *this, struct sockaddr *sockaddr)
{
data_t *address_family_data = NULL;
- address_family_data = dict_get (this->options,
+ address_family_data = dict_get (this->options,
"transport.address-family");
if (!address_family_data) {
data_t *remote_host_data = NULL, *connect_path_data = NULL;
remote_host_data = dict_get (this->options, "remote-host");
- connect_path_data = dict_get (this->options,
+ connect_path_data = dict_get (this->options,
"transport.rdma.connect-path");
- if (!(remote_host_data || connect_path_data) ||
+ if (!(remote_host_data || connect_path_data) ||
(remote_host_data && connect_path_data)) {
gf_log (this->name, GF_LOG_ERROR,
"address-family not specified and not able to "
"determine the same from other options "
- "(remote-host:%s and connect-path:%s)",
- data_to_str (remote_host_data),
+ "(remote-host:%s and connect-path:%s)",
+ data_to_str (remote_host_data),
data_to_str (connect_path_data));
return -1;
- }
+ }
if (remote_host_data) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -167,7 +167,7 @@ client_fill_address_family (rpc_transport_t *this, struct sockaddr *sockaddr)
sockaddr->sa_family = AF_UNSPEC;
} else {
gf_log (this->name, GF_LOG_ERROR,
- "unknown address-family (%s) specified",
+ "unknown address-family (%s) specified",
address_family);
return -1;
}
@@ -177,8 +177,8 @@ client_fill_address_family (rpc_transport_t *this, struct sockaddr *sockaddr)
}
static int32_t
-af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
- struct sockaddr *sockaddr,
+af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
+ struct sockaddr *sockaddr,
socklen_t *sockaddr_len,
int16_t remote_port)
{
@@ -193,7 +193,7 @@ af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
if (remote_host_data == NULL)
{
gf_log (this->name, GF_LOG_ERROR,
- "option remote-host missing in volume %s",
+ "option remote-host missing in volume %s",
this->name);
ret = -1;
goto err;
@@ -203,7 +203,7 @@ af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
if (remote_host == NULL)
{
gf_log (this->name, GF_LOG_ERROR,
- "option remote-host has data NULL in volume %s",
+ "option remote-host has data NULL in volume %s",
this->name);
ret = -1;
goto err;
@@ -238,7 +238,7 @@ af_inet_client_get_remote_sockaddr (rpc_transport_t *this,
/* TODO: gf_resolve is a blocking call. kick in some
non blocking dns techniques */
ret = gf_resolve_ip6 (remote_host, remote_port,
- sockaddr->sa_family,
+ sockaddr->sa_family,
&this->dnscache, &addr_info);
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
@@ -254,8 +254,8 @@ err:
}
static int32_t
-af_unix_client_get_remote_sockaddr (rpc_transport_t *this,
- struct sockaddr *sockaddr,
+af_unix_client_get_remote_sockaddr (rpc_transport_t *this,
+ struct sockaddr *sockaddr,
socklen_t *sockaddr_len)
{
struct sockaddr_un *sockaddr_un = NULL;
@@ -263,7 +263,7 @@ af_unix_client_get_remote_sockaddr (rpc_transport_t *this,
data_t *connect_path_data = NULL;
int32_t ret = 0;
- connect_path_data = dict_get (this->options,
+ connect_path_data = dict_get (this->options,
"transport.rdma.connect-path");
if (!connect_path_data) {
gf_log (this->name, GF_LOG_ERROR,
@@ -311,7 +311,7 @@ af_unix_server_get_local_sockaddr (rpc_transport_t *this,
struct sockaddr_un *sunaddr = (struct sockaddr_un *)addr;
- listen_path_data = dict_get (this->options,
+ listen_path_data = dict_get (this->options,
"transport.rdma.listen-path");
if (!listen_path_data) {
gf_log (this->name, GF_LOG_ERROR,
@@ -342,9 +342,9 @@ err:
return ret;
}
-static int32_t
-af_inet_server_get_local_sockaddr (rpc_transport_t *this,
- struct sockaddr *addr,
+static int32_t
+af_inet_server_get_local_sockaddr (rpc_transport_t *this,
+ struct sockaddr *addr,
socklen_t *addr_len)
{
struct addrinfo hints, *res = 0;
@@ -364,20 +364,20 @@ af_inet_server_get_local_sockaddr (rpc_transport_t *this,
{
listen_port = data_to_uint16 (listen_port_data);
} else {
- if (addr->sa_family == AF_INET6) {
- struct sockaddr_in6 *in = (struct sockaddr_in6 *) addr;
- in->sin6_addr = in6addr_any;
- in->sin6_port = htons(listen_port);
- *addr_len = sizeof(struct sockaddr_in6);
+ if (addr->sa_family == AF_INET6) {
+ struct sockaddr_in6 *in = (struct sockaddr_in6 *) addr;
+ in->sin6_addr = in6addr_any;
+ in->sin6_port = htons(listen_port);
+ *addr_len = sizeof(struct sockaddr_in6);
goto out;
- } else if (addr->sa_family == AF_INET) {
- struct sockaddr_in *in = (struct sockaddr_in *) addr;
- in->sin_addr.s_addr = htonl(INADDR_ANY);
- in->sin_port = htons(listen_port);
- *addr_len = sizeof(struct sockaddr_in);
+ } else if (addr->sa_family == AF_INET) {
+ struct sockaddr_in *in = (struct sockaddr_in *) addr;
+ in->sin_addr.s_addr = htonl(INADDR_ANY);
+ in->sin_port = htons(listen_port);
+ *addr_len = sizeof(struct sockaddr_in);
goto out;
- }
- }
+ }
+ }
if (listen_port == (uint16_t) -1)
listen_port = GF_DEFAULT_RDMA_LISTEN_PORT;
@@ -400,7 +400,7 @@ af_inet_server_get_local_sockaddr (rpc_transport_t *this,
if (ret != 0) {
gf_log (this->name,
GF_LOG_ERROR,
- "getaddrinfo failed for host %s, service %s (%s)",
+ "getaddrinfo failed for host %s, service %s (%s)",
listen_host, service, gai_strerror (ret));
ret = -1;
goto out;
@@ -417,9 +417,9 @@ out:
int32_t
gf_rdma_client_bind (rpc_transport_t *this,
- struct sockaddr *sockaddr,
- socklen_t *sockaddr_len,
- int sock)
+ struct sockaddr *sockaddr,
+ socklen_t *sockaddr_len,
+ int sock)
{
int ret = 0;
@@ -431,13 +431,13 @@ gf_rdma_client_bind (rpc_transport_t *this,
*sockaddr_len = sizeof (struct sockaddr_in);
case AF_INET6:
- ret = af_inet_bind_to_port_lt_ceiling (sock, sockaddr,
- *sockaddr_len,
+ ret = af_inet_bind_to_port_lt_ceiling (sock, sockaddr,
+ *sockaddr_len,
CLIENT_PORT_CEILING);
if (ret == -1) {
gf_log (this->name, GF_LOG_WARNING,
"cannot bind inet socket (%d) to port "
- "less than %d (%s)",
+ "less than %d (%s)",
sock, CLIENT_PORT_CEILING, strerror (errno));
ret = 0;
}
@@ -445,7 +445,7 @@ gf_rdma_client_bind (rpc_transport_t *this,
case AF_UNIX:
*sockaddr_len = sizeof (struct sockaddr_un);
- ret = af_unix_client_bind (this, (struct sockaddr *)sockaddr,
+ ret = af_unix_client_bind (this, (struct sockaddr *)sockaddr,
*sockaddr_len, sock);
break;
@@ -473,7 +473,7 @@ gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
ret = -1;
goto err;
}
-
+
switch (sockaddr->sa_family)
{
case AF_INET_SDP:
@@ -483,7 +483,7 @@ gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
case AF_INET:
case AF_INET6:
case AF_UNSPEC:
- ret = af_inet_client_get_remote_sockaddr (this,
+ ret = af_inet_client_get_remote_sockaddr (this,
sockaddr,
sockaddr_len,
remote_port);
@@ -495,8 +495,8 @@ gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
break;
case AF_UNIX:
- ret = af_unix_client_get_remote_sockaddr (this,
- sockaddr,
+ ret = af_unix_client_get_remote_sockaddr (this,
+ sockaddr,
sockaddr_len);
break;
@@ -505,21 +505,21 @@ gf_rdma_client_get_remote_sockaddr (rpc_transport_t *this,
"unknown address-family %d", sockaddr->sa_family);
ret = -1;
}
-
+
err:
return ret;
}
int32_t
gf_rdma_server_get_local_sockaddr (rpc_transport_t *this,
- struct sockaddr *addr,
- socklen_t *addr_len)
+ struct sockaddr *addr,
+ socklen_t *addr_len)
{
data_t *address_family_data = NULL;
int32_t ret = 0;
char is_inet_sdp = 0;
- address_family_data = dict_get (this->options,
+ address_family_data = dict_get (this->options,
"transport.address-family");
if (address_family_data) {
char *address_family = NULL;
@@ -538,7 +538,7 @@ gf_rdma_server_get_local_sockaddr (rpc_transport_t *this,
addr->sa_family = AF_UNSPEC;
} else {
gf_log (this->name, GF_LOG_ERROR,
- "unknown address family (%s) specified",
+ "unknown address family (%s) specified",
address_family);
ret = -1;
goto err;
@@ -574,8 +574,8 @@ err:
return ret;
}
-int32_t
-fill_inet6_inet_identifiers (rpc_transport_t *this, struct sockaddr_storage *addr,
+int32_t
+fill_inet6_inet_identifiers (rpc_transport_t *this, struct sockaddr_storage *addr,
int32_t addr_len, char *identifier)
{
int32_t ret = 0, tmpaddr_len = 0;
@@ -589,45 +589,45 @@ fill_inet6_inet_identifiers (rpc_transport_t *this, struct sockaddr_storage *add
if (((struct sockaddr *) &tmpaddr)->sa_family == AF_INET6) {
int32_t one_to_four, four_to_eight, twelve_to_sixteen;
int16_t eight_to_ten, ten_to_twelve;
-
+
one_to_four = four_to_eight = twelve_to_sixteen = 0;
eight_to_ten = ten_to_twelve = 0;
-
- one_to_four = ((struct sockaddr_in6 *)
+
+ one_to_four = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr32[0];
- four_to_eight = ((struct sockaddr_in6 *)
+ four_to_eight = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr32[1];
#ifdef GF_SOLARIS_HOST_OS
- eight_to_ten = S6_ADDR16(((struct sockaddr_in6 *)
+ eight_to_ten = S6_ADDR16(((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr)[4];
#else
- eight_to_ten = ((struct sockaddr_in6 *)
+ eight_to_ten = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr16[4];
#endif
#ifdef GF_SOLARIS_HOST_OS
- ten_to_twelve = S6_ADDR16(((struct sockaddr_in6 *)
+ ten_to_twelve = S6_ADDR16(((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr)[5];
#else
- ten_to_twelve = ((struct sockaddr_in6 *)
+ ten_to_twelve = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr16[5];
#endif
- twelve_to_sixteen = ((struct sockaddr_in6 *)
+ twelve_to_sixteen = ((struct sockaddr_in6 *)
&tmpaddr)->sin6_addr.s6_addr32[3];
/* ipv4 mapped ipv6 address has
bits 0-80: 0
bits 80-96: 0xffff
- bits 96-128: ipv4 address
+ bits 96-128: ipv4 address
*/
-
+
if (one_to_four == 0 &&
four_to_eight == 0 &&
eight_to_ten == 0 &&
ten_to_twelve == -1) {
struct sockaddr_in *in_ptr = (struct sockaddr_in *)&tmpaddr;
memset (&tmpaddr, 0, sizeof (tmpaddr));
-
+
in_ptr->sin_family = AF_INET;
in_ptr->sin_port = ((struct sockaddr_in6 *)addr)->sin6_port;
in_ptr->sin_addr.s_addr = twelve_to_sixteen;
@@ -666,8 +666,8 @@ gf_rdma_get_transport_identifiers (rpc_transport_t *this)
case AF_INET:
case AF_INET6:
{
- ret = fill_inet6_inet_identifiers (this,
- &this->myinfo.sockaddr,
+ ret = fill_inet6_inet_identifiers (this,
+ &this->myinfo.sockaddr,
this->myinfo.sockaddr_len,
this->myinfo.identifier);
if (ret == -1) {
@@ -705,7 +705,7 @@ gf_rdma_get_transport_identifiers (rpc_transport_t *this)
break;
default:
- gf_log (this->name, GF_LOG_ERROR,
+ gf_log (this->name, GF_LOG_ERROR,
"unknown address family (%d)",
((struct sockaddr *) &this->myinfo.sockaddr)->sa_family);
ret = -1;
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index 633f57db5b3..81e6e3cf632 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -44,13 +44,13 @@ int
rdma_post_unref (rdma_post_t *post);
int32_t
-gf_resolve_ip6 (const char *hostname,
- uint16_t port,
- int family,
- void **dnscache,
+gf_resolve_ip6 (const char *hostname,
+ uint16_t port,
+ int family,
+ void **dnscache,
struct addrinfo **addr_info);
-static uint16_t
+static uint16_t
rdma_get_local_lid (struct ibv_context *context,
int32_t port)
{
@@ -65,14 +65,14 @@ rdma_get_local_lid (struct ibv_context *context,
static const char *
get_port_state_str(enum ibv_port_state pstate)
{
- switch (pstate) {
- case IBV_PORT_DOWN: return "PORT_DOWN";
- case IBV_PORT_INIT: return "PORT_INIT";
- case IBV_PORT_ARMED: return "PORT_ARMED";
- case IBV_PORT_ACTIVE: return "PORT_ACTIVE";
- case IBV_PORT_ACTIVE_DEFER: return "PORT_ACTIVE_DEFER";
- default: return "invalid state";
- }
+ switch (pstate) {
+ case IBV_PORT_DOWN: return "PORT_DOWN";
+ case IBV_PORT_INIT: return "PORT_INIT";
+ case IBV_PORT_ARMED: return "PORT_ARMED";
+ case IBV_PORT_ACTIVE: return "PORT_ACTIVE";
+ case IBV_PORT_ACTIVE_DEFER: return "PORT_ACTIVE_DEFER";
+ default: return "invalid state";
+ }
}
static int32_t
@@ -84,10 +84,10 @@ ib_check_active_port (struct ibv_context *ctx, uint8_t port)
const char *state_str = NULL;
if (!ctx) {
- gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
+ gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
"Error in supplied context");
return -1;
- }
+ }
ret = ibv_query_port (ctx, port, &port_attr);
@@ -105,29 +105,29 @@ ib_check_active_port (struct ibv_context *ctx, uint8_t port)
if (port_attr.state == IBV_PORT_ACTIVE)
return 0;
- return -1;
+ return -1;
}
static int32_t
ib_get_active_port (struct ibv_context *ib_ctx)
{
- struct ibv_device_attr ib_device_attr;
+ struct ibv_device_attr ib_device_attr;
- int32_t ret = -1;
- uint8_t ib_port = 0;
+ int32_t ret = -1;
+ uint8_t ib_port = 0;
- if (!ib_ctx) {
- gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
+ if (!ib_ctx) {
+ gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
"Error in supplied context");
- return -1;
- }
- if (ibv_query_device (ib_ctx, &ib_device_attr)) {
- gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
+ return -1;
+ }
+ if (ibv_query_device (ib_ctx, &ib_device_attr)) {
+ gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
"Failed to query device properties");
- return -1;
- }
+ return -1;
+ }
- for (ib_port = 1; ib_port <= ib_device_attr.phys_port_cnt; ++ib_port) {
+ for (ib_port = 1; ib_port <= ib_device_attr.phys_port_cnt; ++ib_port) {
ret = ib_check_active_port (ib_ctx, ib_port);
if (ret == 0)
return ib_port;
@@ -135,8 +135,8 @@ ib_get_active_port (struct ibv_context *ib_ctx)
gf_log (RDMA_LOG_NAME, GF_LOG_TRACE,
"Port:(%u) not active", ib_port);
continue;
- }
- return ret;
+ }
+ return ret;
}
@@ -228,7 +228,7 @@ rdma_get_post (rdma_queue_t *queue)
post = queue->passive_posts.next;
if (post == &queue->passive_posts)
post = NULL;
-
+
if (post) {
if (post->prev)
post->prev->next = post->next;
@@ -286,7 +286,7 @@ __rdma_quota_get (rdma_peer_t *peer)
}
*/
-static void
+static void
__rdma_ioq_entry_free (rdma_ioq_t *entry)
{
list_del_init (&entry->list);
@@ -333,7 +333,7 @@ __rdma_disconnect (rpc_transport_t *this)
priv->tcp_connected = 0;
}
}
-
+
return ret;
}
@@ -368,7 +368,7 @@ __rdma_encode_error(rdma_peer_t *peer, rdma_reply_info_t *reply_info,
struct iovec *rpchdr, uint32_t *ptr,
rdma_errcode_t err)
{
- uint32_t *startp = NULL;
+ uint32_t *startp = NULL;
struct rpc_msg *rpc_msg = NULL;
startp = ptr;
@@ -382,16 +382,16 @@ __rdma_encode_error(rdma_peer_t *peer, rdma_reply_info_t *reply_info,
*ptr++ = rpc_msg->rm_xid;
}
- *ptr++ = hton32(RDMA_VERSION);
- *ptr++ = hton32(peer->send_count);
- *ptr++ = hton32(RDMA_ERROR);
- *ptr++ = hton32(err);
- if (err == ERR_VERS) {
- *ptr++ = hton32(RDMA_VERSION);
- *ptr++ = hton32(RDMA_VERSION);
- }
+ *ptr++ = hton32(RDMA_VERSION);
+ *ptr++ = hton32(peer->send_count);
+ *ptr++ = hton32(RDMA_ERROR);
+ *ptr++ = hton32(err);
+ if (err == ERR_VERS) {
+ *ptr++ = hton32(RDMA_VERSION);
+ *ptr++ = hton32(RDMA_VERSION);
+ }
- return (int)((unsigned long)ptr - (unsigned long)startp);
+ return (int)((unsigned long)ptr - (unsigned long)startp);
}
@@ -438,7 +438,7 @@ __rdma_create_read_chunks_from_vector (rdma_peer_t *peer,
rdma_private_t *priv = NULL;
rdma_device_t *device = NULL;
struct ibv_mr *mr = NULL;
- rdma_read_chunk_t *readch = NULL;
+ rdma_read_chunk_t *readch = NULL;
int32_t ret = -1;
if ((peer == NULL) || (readch_ptr == NULL) || (*readch_ptr == NULL)
@@ -576,7 +576,7 @@ __rdma_create_write_chunks_from_vector (rdma_peer_t *peer,
rdma_private_t *priv = NULL;
rdma_device_t *device = NULL;
struct ibv_mr *mr = NULL;
- rdma_write_chunk_t *writech = NULL;
+ rdma_write_chunk_t *writech = NULL;
int32_t ret = -1;
if ((peer == NULL) || (writech_ptr == NULL) || (*writech_ptr == NULL)
@@ -588,7 +588,7 @@ __rdma_create_write_chunks_from_vector (rdma_peer_t *peer,
priv = peer->trans->private;
device = priv->device;
-
+
for (i = 0; i < count; i++) {
mr = ibv_reg_mr (device->pd, vector[i].iov_base,
vector[i].iov_len,
@@ -645,15 +645,15 @@ __rdma_create_write_chunks (rdma_peer_t *peer, rdma_ioq_t *entry,
}
/*
- if ((chunk_type == rdma_writech)
- && ((entry->msg.request.rsphdr_count == 0)
- || (entry->msg.request.rsphdr_vec[0].iov_base == NULL))) {
- gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG,
- "vector specifying buffer to hold the program's reply "
- "header should also be provided when buffers are "
- "provided for holding the program's payload in reply");
- goto out;
- }
+ if ((chunk_type == rdma_writech)
+ && ((entry->msg.request.rsphdr_count == 0)
+ || (entry->msg.request.rsphdr_vec[0].iov_base == NULL))) {
+ gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG,
+ "vector specifying buffer to hold the program's reply "
+ "header should also be provided when buffers are "
+ "provided for holding the program's payload in reply");
+ goto out;
+ }
*/
if (chunk_type == rdma_writech) {
@@ -684,7 +684,7 @@ __rdma_create_write_chunks (rdma_peer_t *peer, rdma_ioq_t *entry,
**ptr = 0;
*ptr = *ptr + 1;
} else {
- /* no write chunklist */
+ /* no write chunklist */
**ptr = 0;
*ptr = *ptr + 1;
@@ -693,7 +693,7 @@ __rdma_create_write_chunks (rdma_peer_t *peer, rdma_ioq_t *entry,
warray->wc_nchunks = hton32 (entry->msg.request.rsphdr_count);
*ptr = (uint32_t *)&warray->wc_array[0];
-
+
ret = __rdma_create_write_chunks_from_vector (peer,
(rdma_write_chunk_t **)ptr,
entry->msg.request.rsphdr_vec,
@@ -918,7 +918,7 @@ rdma_post_ref (rdma_post_t *post)
post->refcount++;
}
pthread_mutex_unlock (&post->lock);
-
+
out:
return post;
}
@@ -928,7 +928,7 @@ int32_t
__rdma_ioq_churn_request (rdma_peer_t *peer, rdma_ioq_t *entry,
rdma_post_t *post)
{
- rdma_chunktype_t rtype = rdma_noch, wtype = rdma_noch;
+ rdma_chunktype_t rtype = rdma_noch, wtype = rdma_noch;
uint64_t send_size = 0;
rdma_header_t *hdr = NULL;
struct rpc_msg *rpc_msg = NULL;
@@ -1086,7 +1086,7 @@ __rdma_ioq_churn_request (rdma_peer_t *peer, rdma_ioq_t *entry,
}
len = buf - post->buf;
-
+
rdma_post_ref (post);
ret = rdma_post_send (peer->qp, post, len);
@@ -1127,9 +1127,9 @@ __rdma_fill_reply_header (rdma_header_t *header, struct iovec *rpchdr,
header->rm_xid = hton32 (reply_info->rm_xid);
} else {
rpc_msg = rpchdr[0].iov_base; /* assume rpchdr contains
- * only one vector.
- * (which is true)
- */
+ * only one vector.
+ * (which is true)
+ */
header->rm_xid = rpc_msg->rm_xid;
}
@@ -1188,7 +1188,7 @@ __rdma_send_reply_inline (rdma_peer_t *peer, rdma_ioq_t *entry,
iov_unload (buf, entry->proghdr, entry->proghdr_count);
buf += iov_length (entry->proghdr, entry->proghdr_count);
}
-
+
if (entry->prog_payload_count != 0) {
iov_unload (buf, entry->prog_payload,
entry->prog_payload_count);
@@ -1250,7 +1250,7 @@ __rdma_reply_encode_write_chunks (rdma_peer_t *peer, uint32_t payload_size,
target_array->wc_array[i].wc_target.rs_length
= hton32 (min (payload_size,
- reply_info->wc_array->wc_array[i].wc_target.rs_length));
+ reply_info->wc_array->wc_array[i].wc_target.rs_length));
}
target_array->wc_nchunks = hton32 (i);
@@ -1313,7 +1313,7 @@ out:
* 2. modifies vec
*/
int32_t
-__rdma_write (rdma_peer_t *peer, rdma_post_t *post, struct iovec *vec,
+__rdma_write (rdma_peer_t *peer, rdma_post_t *post, struct iovec *vec,
uint32_t xfer_len, int *idx, rdma_write_chunk_t *writech)
{
int size = 0, num_sge = 0, i = 0;
@@ -1389,7 +1389,7 @@ __rdma_do_rdma_write (rdma_peer_t *peer, rdma_post_t *post,
int i = 0, payload_idx = 0;
uint32_t payload_size = 0, xfer_len = 0;
int32_t ret = -1;
-
+
if (count != 0) {
payload_size = iov_length (vector, count);
}
@@ -1488,7 +1488,7 @@ __rdma_send_reply_type_nomsg (rdma_peer_t *peer, rdma_ioq_t *entry,
if (ret) {
gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG,
"rdma_post_send to client (%s) failed with "
- "ret = %d (%s)", peer->trans->peerinfo.identifier, ret,
+ "ret = %d (%s)", peer->trans->peerinfo.identifier, ret,
(ret > 0) ? strerror (ret) : "");
ret = -1;
rdma_post_unref (post);
@@ -1689,7 +1689,7 @@ __rdma_ioq_churn_entry (rdma_peer_t *peer, rdma_ioq_t *entry)
quota = __rdma_quota_get (peer);
if (quota > 0) {
post = rdma_get_post (&device->sendq);
- if (post == NULL) {
+ if (post == NULL) {
post = rdma_new_post (device,
(options->send_size + 2048),
RDMA_SEND_POST);
@@ -1821,7 +1821,7 @@ rdma_ioq_new (rpc_transport_t *this, rpc_transport_data_t *data)
if (data->data.req.rsp.rsp_payload_count != 0) {
for (i = 0; i < data->data.req.rsp.rsp_payload_count;
i++) {
- entry->msg.request.rsp_payload[i]
+ entry->msg.request.rsp_payload[i]
= data->data.req.rsp.rsp_payload[i];
}
@@ -1881,7 +1881,7 @@ rdma_submit_request (rpc_transport_t *this,
{
int32_t ret = 0;
rdma_ioq_t *entry = NULL;
- rpc_transport_data_t data = {0, };
+ rpc_transport_data_t data = {0, };
if (req == NULL) {
goto out;
@@ -1985,7 +1985,7 @@ rdma_receive (rpc_transport_t *this, char **hdr_p, size_t *hdrlen_p,
ret = -1;
goto err;
}
-
+
copy_from += sizeof (*header);
if (size1) {
@@ -2027,11 +2027,11 @@ rdma_destroy_cq (rpc_transport_t *this)
{
rdma_private_t *priv = this->private;
rdma_device_t *device = priv->device;
-
+
if (device->recv_cq)
ibv_destroy_cq (device->recv_cq);
device->recv_cq = NULL;
-
+
if (device->send_cq)
ibv_destroy_cq (device->send_cq);
device->send_cq = NULL;
@@ -2072,7 +2072,7 @@ rdma_create_cq (rpc_transport_t *this)
ret = -1;
goto out;
}
-
+
do {
ret = ibv_query_device (priv->device->context, &device_attr);
if (ret != 0) {
@@ -2219,7 +2219,7 @@ __rdma_lookup_peer (rdma_device_t *device, int32_t qp_num)
{
rdma_qpreg_t *qpreg = NULL;
rdma_peer_t *peer = NULL;
-
+
qpreg = &device->qpreg;
pthread_mutex_lock (&qpreg->lock);
{
@@ -2269,7 +2269,7 @@ rdma_create_qp (rpc_transport_t *this)
},
.qp_type = IBV_QPT_RC
};
-
+
struct ibv_qp_attr attr = {
.qp_state = IBV_QPS_INIT,
.pkey_index = 0,
@@ -2277,7 +2277,7 @@ rdma_create_qp (rpc_transport_t *this)
.qp_access_flags
= IBV_ACCESS_REMOTE_READ | IBV_ACCESS_REMOTE_WRITE
};
-
+
peer->qp = ibv_create_qp (device->pd, &init_attr);
if (!peer->qp) {
gf_log (RDMA_LOG_NAME,
@@ -2504,7 +2504,7 @@ __tcp_rwv (rpc_transport_t *this, struct iovec *vector, int count,
if (ret == 0)
{
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_DEBUG,
"EOF from peer %s", this->peerinfo.identifier);
opcount = -1;
errno = ENOTCONN;
@@ -2519,7 +2519,7 @@ __tcp_rwv (rpc_transport_t *this, struct iovec *vector, int count,
gf_log (this->name, GF_LOG_DEBUG,
"%s failed (%s)", write ? "writev" : "readv",
strerror (errno));
- if (write && !priv->connected &&
+ if (write && !priv->connected &&
(errno == ECONNREFUSED))
gf_log (this->name, GF_LOG_ERROR,
"possible mismatch of 'rpc-transport-type'"
@@ -2569,7 +2569,7 @@ __tcp_readv (rpc_transport_t *this, struct iovec *vector, int count,
{
int ret = -1;
- ret = __tcp_rwv (this, vector, count,
+ ret = __tcp_rwv (this, vector, count,
pending_vector, pending_count, 0);
return ret;
@@ -2583,16 +2583,16 @@ __tcp_writev (rpc_transport_t *this, struct iovec *vector, int count,
int ret = -1;
rdma_private_t *priv = this->private;
- ret = __tcp_rwv (this, vector, count, pending_vector,
+ ret = __tcp_rwv (this, vector, count, pending_vector,
pending_count, 1);
if (ret > 0) {
- /* TODO: Avoid multiple calls when socket is already
+ /* TODO: Avoid multiple calls when socket is already
registered for POLLOUT */
- priv->idx = event_select_on (this->ctx->event_pool,
+ priv->idx = event_select_on (this->ctx->event_pool,
priv->sock, priv->idx, -1, 1);
} else if (ret == 0) {
- priv->idx = event_select_on (this->ctx->event_pool,
+ priv->idx = event_select_on (this->ctx->event_pool,
priv->sock,
priv->idx, -1, 0);
}
@@ -2696,14 +2696,14 @@ rdma_decode_error_msg (rdma_peer_t *peer, rdma_post_t *post,
struct iobuf *iobuf = NULL;
struct iobref *iobref = NULL;
int32_t ret = -1;
-
+
header = (rdma_header_t *)post->buf;
header->rm_body.rm_error.rm_type
= ntoh32 (header->rm_body.rm_error.rm_type);
if (header->rm_body.rm_error.rm_type == ERR_VERS) {
- header->rm_body.rm_error.rm_version.rdma_vers_low =
+ header->rm_body.rm_error.rm_version.rdma_vers_low =
ntoh32 (header->rm_body.rm_error.rm_version.rdma_vers_low);
- header->rm_body.rm_error.rm_version.rdma_vers_high =
+ header->rm_body.rm_error.rm_version.rdma_vers_high =
ntoh32 (header->rm_body.rm_error.rm_version.rdma_vers_high);
}
@@ -2761,7 +2761,7 @@ rdma_decode_msg (rdma_peer_t *peer, rdma_post_t *post,
rdma_reply_info_t *reply_info = NULL;
char *ptr = NULL;
rdma_write_array_t *write_ary = NULL;
- size_t header_len = 0;
+ size_t header_len = 0;
header = (rdma_header_t *)post->buf;
@@ -2939,7 +2939,7 @@ rdma_do_reads (rdma_peer_t *peer, rdma_post_t *post, rdma_read_chunk_t *readch)
{
int32_t ret = -1, i = 0, count = 0;
size_t size = 0;
- char *ptr = NULL;
+ char *ptr = NULL;
struct iobuf *iobuf = NULL;
rdma_private_t *priv = NULL;
@@ -3049,7 +3049,7 @@ rdma_pollin_notify (rdma_peer_t *peer, rdma_post_t *post)
goto out;
}
- /* handling the case where both hdr and payload of
+ /* handling the case where both hdr and payload of
* GF_FOP_READ_CBK were recieved in a single iobuf
* because of server sending entire msg as inline without
* doing rdma writes.
@@ -3080,7 +3080,7 @@ rdma_pollin_notify (rdma_peer_t *peer, rdma_post_t *post)
if (ret == -1) {
gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG,
"cannot get request information from rpc "
- "layer");
+ "layer");
goto out;
}
@@ -3132,7 +3132,7 @@ rdma_recv_reply (rdma_peer_t *peer, rdma_post_t *post)
int i = 0;
uint32_t *ptr = NULL;
rdma_request_context_t *ctx = NULL;
- rpc_request_info_t request_info = {0, };
+ rpc_request_info_t request_info = {0, };
struct rpc_req *rpc_req = NULL;
header = (rdma_header_t *)post->buf;
@@ -3160,7 +3160,7 @@ rdma_recv_reply (rdma_peer_t *peer, rdma_post_t *post)
post->ctx.vector[i + 1].iov_len
= wc_array->wc_array[i].wc_target.rs_length;
}
-
+
post->ctx.count += wc_array->wc_nchunks;
}
@@ -3173,7 +3173,7 @@ rdma_recv_reply (rdma_peer_t *peer, rdma_post_t *post)
if (ret == -1) {
gf_log (RDMA_LOG_NAME, GF_LOG_DEBUG,
"cannot get request information from rpc "
- "layer");
+ "layer");
goto out;
}
@@ -3208,7 +3208,7 @@ rdma_recv_request (rdma_peer_t *peer, rdma_post_t *post,
rdma_read_chunk_t *readch)
{
int32_t ret = -1;
-
+
if (readch != NULL) {
ret = rdma_do_reads (peer, post, readch);
} else {
@@ -3322,7 +3322,7 @@ rdma_recv_completion_proc (void *data)
}
device = event_ctx;
-
+
ret = ibv_req_notify_cq (event_cq, 0);
if (ret) {
gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
@@ -3382,7 +3382,7 @@ rdma_recv_completion_proc (void *data)
rdma_post_unref (post);
}
-
+
if (ret < 0) {
gf_log (RDMA_LOG_NAME,
GF_LOG_ERROR,
@@ -3419,7 +3419,7 @@ rdma_handle_failed_send_completion (rdma_peer_t *peer, struct ibv_wc *wc)
"send work request on `%s' returned error "
"wc.status = %d, wc.vendor_err = %d, post->buf = %p, "
"wc.byte_len = %d, post->reused = %d",
- (device != NULL) ? device->device_name : NULL, wc->status,
+ (device != NULL) ? device->device_name : NULL, wc->status,
wc->vendor_err, post->buf, wc->byte_len, post->reused);
if (wc->status == IBV_WC_RETRY_EXC_ERR) {
@@ -3484,7 +3484,7 @@ rdma_send_completion_proc (void *data)
struct ibv_wc wc = {0, };
char is_request = 0;
int32_t ret = 0, quota_ret = 0;
-
+
chan = data;
while (1) {
ret = ibv_get_cq_event (chan, &event_cq, &event_ctx);
@@ -3494,7 +3494,7 @@ rdma_send_completion_proc (void *data)
"send thread: %d (%d)", ret, errno);
continue;
}
-
+
device = event_ctx;
ret = ibv_req_notify_cq (event_cq, 0);
@@ -3542,12 +3542,12 @@ rdma_send_completion_proc (void *data)
&& (post->type == RDMA_SEND_POST)
&& (peer != NULL)) {
/* An RDMA_RECV_POST can end up in
- * rdma_send_completion_proc for
+ * rdma_send_completion_proc for
* rdma-reads, and we do not take
* quota for getting an RDMA_RECV_POST.
*/
- /*
+ /*
* if it is request, quota is returned
* after reply has come.
*/
@@ -3577,7 +3577,7 @@ rdma_send_completion_proc (void *data)
continue;
}
- ibv_ack_cq_events (event_cq, 1);
+ ibv_ack_cq_events (event_cq, 1);
}
return NULL;
@@ -3688,7 +3688,7 @@ rdma_get_device (rpc_transport_t *this,
port = priv->options.port;
while (trav) {
- if ((!strcmp (trav->device_name, device_name)) &&
+ if ((!strcmp (trav->device_name, device_name)) &&
(trav->port == port))
break;
trav = trav->next;
@@ -3696,7 +3696,7 @@ rdma_get_device (rpc_transport_t *this,
if (!trav) {
- trav = GF_CALLOC (1, sizeof (*trav),
+ trav = GF_CALLOC (1, sizeof (*trav),
gf_common_mt_rdma_device_t);
if (trav == NULL) {
gf_log (RDMA_LOG_NAME, GF_LOG_ERROR, "out of memory");
@@ -3707,18 +3707,18 @@ rdma_get_device (rpc_transport_t *this,
trav->context = ibctx;
- ret = ib_get_active_port (trav->context);
+ ret = ib_get_active_port (trav->context);
- if (ret < 0) {
- if (!port) {
- gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
- "Failed to find any active ports and "
- "none specified in volume file,"
+ if (ret < 0) {
+ if (!port) {
+ gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
+ "Failed to find any active ports and "
+ "none specified in volume file,"
" exiting");
GF_FREE (trav);
- return NULL;
- }
- }
+ return NULL;
+ }
+ }
trav->request_ctx_pool = mem_pool_new (rdma_request_context_t,
RDMA_POOL_SIZE);
@@ -3744,7 +3744,7 @@ rdma_get_device (rpc_transport_t *this,
}
- active_port = ret;
+ active_port = ret;
if (port) {
ret = ib_check_active_port (trav->context, port);
@@ -3754,11 +3754,11 @@ rdma_get_device (rpc_transport_t *this,
"found to be offline, continuing to "
"use the same port", device_name, port);
}
- } else {
- priv->options.port = active_port;
- port = active_port;
- gf_log (RDMA_LOG_NAME, GF_LOG_TRACE,
- "Port unspecified in volume file using active "
+ } else {
+ priv->options.port = active_port;
+ port = active_port;
+ gf_log (RDMA_LOG_NAME, GF_LOG_TRACE,
+ "Port unspecified in volume file using active "
"port: %u", port);
}
@@ -3780,7 +3780,7 @@ rdma_get_device (rpc_transport_t *this,
GF_FREE (trav);
return NULL;
}
-
+
trav->recv_chan = ibv_create_comp_channel (trav->context);
if (!trav->recv_chan) {
mem_pool_destroy (trav->ioq_pool);
@@ -3794,7 +3794,7 @@ rdma_get_device (rpc_transport_t *this,
/* TODO: cleanup current mess */
return NULL;
}
-
+
if (rdma_create_cq (this) < 0) {
mem_pool_destroy (trav->ioq_pool);
mem_pool_destroy (trav->request_ctx_pool);
@@ -3914,7 +3914,7 @@ rdma_get_device (rpc_transport_t *this,
"could not create recv completion thread");
return NULL;
}
-
+
/* qpreg */
pthread_mutex_init (&trav->qpreg.lock, NULL);
for (i=0; i<42; i++) {
@@ -3925,39 +3925,39 @@ rdma_get_device (rpc_transport_t *this,
return trav;
}
-static int32_t
+static int32_t
rdma_init (rpc_transport_t *this)
{
rdma_private_t *priv = this->private;
rdma_options_t *options = &priv->options;
struct ibv_device **dev_list;
- struct ibv_context *ib_ctx = NULL;
- int32_t ret = 0;
+ struct ibv_context *ib_ctx = NULL;
+ int32_t ret = 0;
rdma_options_init (this);
{
dev_list = ibv_get_device_list (NULL);
- if (!dev_list) {
+ if (!dev_list) {
gf_log (RDMA_LOG_NAME,
GF_LOG_CRITICAL,
"Failed to get IB devices");
- ret = -1;
- goto cleanup;
+ ret = -1;
+ goto cleanup;
}
if (!*dev_list) {
gf_log (RDMA_LOG_NAME,
GF_LOG_CRITICAL,
"No IB devices found");
- ret = -1;
+ ret = -1;
goto cleanup;
}
if (!options->device_name) {
if (*dev_list) {
- options->device_name =
+ options->device_name =
gf_strdup (ibv_get_device_name (*dev_list));
} else {
gf_log (RDMA_LOG_NAME, GF_LOG_CRITICAL,
@@ -3968,7 +3968,7 @@ rdma_init (rpc_transport_t *this)
}
}
- while (*dev_list) {
+ while (*dev_list) {
if (!strcmp (ibv_get_device_name (*dev_list),
options->device_name)) {
ib_ctx = ibv_open_device (*dev_list);
@@ -3983,38 +3983,38 @@ rdma_init (rpc_transport_t *this)
}
break;
}
- ++dev_list;
- }
+ ++dev_list;
+ }
- priv->device = rdma_get_device (this, ib_ctx);
+ priv->device = rdma_get_device (this, ib_ctx);
if (!priv->device) {
gf_log (RDMA_LOG_NAME, GF_LOG_ERROR,
"could not create rdma device for %s",
options->device_name);
ret = -1;
- goto cleanup;
+ goto cleanup;
}
}
priv->peer.trans = this;
INIT_LIST_HEAD (&priv->peer.ioq);
-
+
pthread_mutex_init (&priv->read_mutex, NULL);
pthread_mutex_init (&priv->write_mutex, NULL);
pthread_mutex_init (&priv->recv_mutex, NULL);
pthread_cond_init (&priv->recv_cond, NULL);
cleanup:
- if (-1 == ret) {
- if (ib_ctx)
- ibv_close_device (ib_ctx);
- }
+ if (-1 == ret) {
+ if (ib_ctx)
+ ibv_close_device (ib_ctx);
+ }
- if (dev_list)
- ibv_free_device_list (dev_list);
+ if (dev_list)
+ ibv_free_device_list (dev_list);
- return ret;
+ return ret;
}
@@ -4023,7 +4023,7 @@ rdma_disconnect (rpc_transport_t *this)
{
rdma_private_t *priv = this->private;
int32_t ret = 0;
-
+
pthread_mutex_lock (&priv->write_mutex);
{
ret = __rdma_disconnect (this);
@@ -4054,7 +4054,7 @@ __tcp_connect_finish (int fd)
}
static inline void
-rdma_fill_handshake_data (char *buf, struct rdma_nbio *nbio,
+rdma_fill_handshake_data (char *buf, struct rdma_nbio *nbio,
rdma_private_t *priv)
{
sprintf (buf,
@@ -4099,7 +4099,7 @@ rdma_handshake_pollin (rpc_transport_t *this)
{
while (priv->handshake.incoming.state != RDMA_HANDSHAKE_COMPLETE)
{
- switch (priv->handshake.incoming.state)
+ switch (priv->handshake.incoming.state)
{
case RDMA_HANDSHAKE_START:
buf = priv->handshake.incoming.buf = GF_CALLOC (1, 256, gf_common_mt_char);
@@ -4109,10 +4109,10 @@ rdma_handshake_pollin (rpc_transport_t *this)
break;
case RDMA_HANDSHAKE_RECEIVING_DATA:
- ret = __tcp_readv (this,
- &priv->handshake.incoming.vector,
+ ret = __tcp_readv (this,
+ &priv->handshake.incoming.vector,
priv->handshake.incoming.count,
- &priv->handshake.incoming.pending_vector,
+ &priv->handshake.incoming.pending_vector,
&priv->handshake.incoming.pending_count);
if (ret == -1) {
goto unlock;
@@ -4123,7 +4123,7 @@ rdma_handshake_pollin (rpc_transport_t *this)
"partial header read on NB socket. continue later");
goto unlock;
}
-
+
if (!ret) {
priv->handshake.incoming.state = RDMA_HANDSHAKE_RECEIVED_DATA;
}
@@ -4140,11 +4140,11 @@ rdma_handshake_pollin (rpc_transport_t *this)
&priv->peer.remote_psn);
if ((ret != 5) && (strncmp (buf, "QP1:", 4))) {
- gf_log (RDMA_LOG_NAME,
+ gf_log (RDMA_LOG_NAME,
GF_LOG_CRITICAL,
"%s: remote-host(%s)'s "
"transport type is different",
- this->name,
+ this->name,
this->peerinfo.identifier);
ret = -1;
goto unlock;
@@ -4154,7 +4154,7 @@ rdma_handshake_pollin (rpc_transport_t *this)
priv->peer.recv_size = recv_buf_size;
if (send_buf_size < priv->peer.send_size)
priv->peer.send_size = send_buf_size;
-
+
gf_log (RDMA_LOG_NAME, GF_LOG_TRACE,
"%s: transacted recv_size=%d "
"send_size=%d",
@@ -4164,7 +4164,7 @@ rdma_handshake_pollin (rpc_transport_t *this)
priv->peer.quota = priv->peer.send_count;
if (rdma_connect_qp (this)) {
- gf_log (RDMA_LOG_NAME,
+ gf_log (RDMA_LOG_NAME,
GF_LOG_ERROR,
"%s: failed to connect with "
"remote QP", this->name);
@@ -4177,10 +4177,10 @@ rdma_handshake_pollin (rpc_transport_t *this)
break;
case RDMA_HANDSHAKE_RECEIVING_ACK:
- ret = __tcp_readv (this,
- &priv->handshake.incoming.vector,
+ ret = __tcp_readv (this,
+ &priv->handshake.incoming.vector,
priv->handshake.incoming.count,
- &priv->handshake.incoming.pending_vector,
+ &priv->handshake.incoming.pending_vector,
&priv->handshake.incoming.pending_count);
if (ret == -1) {
goto unlock;
@@ -4192,7 +4192,7 @@ rdma_handshake_pollin (rpc_transport_t *this)
"socket. continue later");
goto unlock;
}
-
+
if (!ret) {
priv->handshake.incoming.state = RDMA_HANDSHAKE_RECEIVED_ACK;
}
@@ -4200,7 +4200,7 @@ rdma_handshake_pollin (rpc_transport_t *this)
case RDMA_HANDSHAKE_RECEIVED_ACK:
if (strncmp (buf, "DONE", 4)) {
- gf_log (RDMA_LOG_NAME,
+ gf_log (RDMA_LOG_NAME,
GF_LOG_DEBUG,
"%s: handshake-3 did not "
"return 'DONE' (%s)",
@@ -4245,7 +4245,7 @@ unlock:
return ret;
}
-static int
+static int
rdma_handshake_pollout (rpc_transport_t *this)
{
rdma_private_t *priv = this->private;
@@ -4260,7 +4260,7 @@ rdma_handshake_pollout (rpc_transport_t *this)
{
while (priv->handshake.outgoing.state != RDMA_HANDSHAKE_COMPLETE)
{
- switch (priv->handshake.outgoing.state)
+ switch (priv->handshake.outgoing.state)
{
case RDMA_HANDSHAKE_START:
buf = priv->handshake.outgoing.buf = GF_CALLOC (1, 256, gf_common_mt_char);
@@ -4269,10 +4269,10 @@ rdma_handshake_pollout (rpc_transport_t *this)
break;
case RDMA_HANDSHAKE_SENDING_DATA:
- ret = __tcp_writev (this,
- &priv->handshake.outgoing.vector,
+ ret = __tcp_writev (this,
+ &priv->handshake.outgoing.vector,
priv->handshake.outgoing.count,
- &priv->handshake.outgoing.pending_vector,
+ &priv->handshake.outgoing.pending_vector,
&priv->handshake.outgoing.pending_count);
if (ret == -1) {
goto unlock;
@@ -4283,7 +4283,7 @@ rdma_handshake_pollout (rpc_transport_t *this)
"partial header read on NB socket. continue later");
goto unlock;
}
-
+
if (!ret) {
priv->handshake.outgoing.state = RDMA_HANDSHAKE_SENT_DATA;
}
@@ -4311,7 +4311,7 @@ rdma_handshake_pollout (rpc_transport_t *this)
"socket. continue later");
goto unlock;
}
-
+
if (!ret) {
GF_FREE (priv->handshake.outgoing.buf);
priv->handshake.outgoing.buf = NULL;
@@ -4350,7 +4350,7 @@ rdma_handshake_pollerr (rpc_transport_t *this)
connected = priv->connected;
if (priv->sock != -1) {
- event_unregister (this->ctx->event_pool,
+ event_unregister (this->ctx->event_pool,
priv->sock, priv->idx);
need_unref = 1;
@@ -4402,16 +4402,16 @@ tcp_connect_finish (rpc_transport_t *this)
ret = __tcp_connect_finish (priv->sock);
if (!ret) {
- this->myinfo.sockaddr_len =
+ this->myinfo.sockaddr_len =
sizeof (this->myinfo.sockaddr);
ret = getsockname (priv->sock,
- (struct sockaddr *)&this->myinfo.sockaddr,
+ (struct sockaddr *)&this->myinfo.sockaddr,
&this->myinfo.sockaddr_len);
- if (ret == -1)
+ if (ret == -1)
{
gf_log (this->name, GF_LOG_ERROR,
"getsockname on new client-socket %d "
- "failed (%s)",
+ "failed (%s)",
priv->sock, strerror (errno));
close (priv->sock);
error = 1;
@@ -4424,7 +4424,7 @@ tcp_connect_finish (rpc_transport_t *this)
if (ret == -1 && errno != EINPROGRESS) {
gf_log (this->name, GF_LOG_ERROR,
- "tcp connect to %s failed (%s)",
+ "tcp connect to %s failed (%s)",
this->peerinfo.identifier, strerror (errno));
error = 1;
}
@@ -4508,9 +4508,9 @@ static int32_t
rdma_connect (struct rpc_transport *this, int port)
{
dict_t *options = this->options;
-
+
rdma_private_t *priv = this->private;
-
+
int32_t ret = 0;
gf_boolean_t non_blocking = 1;
struct sockaddr_storage sockaddr;
@@ -4523,7 +4523,7 @@ rdma_connect (struct rpc_transport *this, int port)
if (dict_get (options, "non-blocking-io")) {
char *nb_connect = data_to_str (dict_get (this->options,
"non-blocking-io"));
-
+
if (gf_string2boolean (nb_connect, &non_blocking) == -1) {
gf_log (this->name, GF_LOG_ERROR,
"'non-blocking-io' takes only boolean "
@@ -4547,10 +4547,10 @@ rdma_connect (struct rpc_transport *this, int port)
ret = 0;
goto unlock;
}
-
+
priv->sock = socket (((struct sockaddr *)&sockaddr)->sa_family,
SOCK_STREAM, 0);
-
+
if (priv->sock == -1) {
gf_log (this->name, GF_LOG_ERROR,
"socket () - error: %s", strerror (errno));
@@ -4568,13 +4568,13 @@ rdma_connect (struct rpc_transport *this, int port)
((struct sockaddr_in *) (&sockaddr))->sin_port
= htons (port);
- ((struct sockaddr *) &this->myinfo.sockaddr)->sa_family =
+ ((struct sockaddr *) &this->myinfo.sockaddr)->sa_family =
((struct sockaddr *)&this->peerinfo.sockaddr)->sa_family;
- if (non_blocking)
+ if (non_blocking)
{
ret = __tcp_nonblock (priv->sock);
-
+
if (ret == -1)
{
gf_log (this->name, GF_LOG_ERROR,
@@ -4599,13 +4599,13 @@ rdma_connect (struct rpc_transport *this, int port)
goto unlock;
}
- ret = connect (priv->sock,
- (struct sockaddr *)&this->peerinfo.sockaddr,
+ ret = connect (priv->sock,
+ (struct sockaddr *)&this->peerinfo.sockaddr,
this->peerinfo.sockaddr_len);
if (ret == -1 && errno != EINPROGRESS)
{
gf_log (this->name, GF_LOG_ERROR,
- "connection attempt failed (%s)",
+ "connection attempt failed (%s)",
strerror (errno));
close (priv->sock);
priv->sock = -1;
@@ -4618,10 +4618,10 @@ rdma_connect (struct rpc_transport *this, int port)
priv->handshake.incoming.state = RDMA_HANDSHAKE_START;
priv->handshake.outgoing.state = RDMA_HANDSHAKE_START;
-
- priv->idx = event_register (this->ctx->event_pool,
+
+ priv->idx = event_register (this->ctx->event_pool,
priv->sock, rdma_event_handler,
- this, 1, 1);
+ this, 1, 1);
}
unlock:
pthread_mutex_unlock (&priv->write_mutex);
@@ -4660,7 +4660,7 @@ rdma_server_event_handler (int fd, int idx, void *data,
return -1;
}
this->private = priv;
- /* Copy all the rdma related values in priv, from trans_priv
+ /* Copy all the rdma related values in priv, from trans_priv
as other than QP, all the values remain same */
priv->device = trans_priv->device;
priv->options = trans_priv->options;
@@ -4677,14 +4677,14 @@ rdma_server_event_handler (int fd, int idx, void *data,
this->notify = trans->notify;
this->mydata = trans->mydata;
- memcpy (&this->myinfo.sockaddr, &trans->myinfo.sockaddr,
+ memcpy (&this->myinfo.sockaddr, &trans->myinfo.sockaddr,
trans->myinfo.sockaddr_len);
this->myinfo.sockaddr_len = trans->myinfo.sockaddr_len;
main_sock = (trans_priv)->sock;
this->peerinfo.sockaddr_len = sizeof (this->peerinfo.sockaddr);
- priv->sock = accept (main_sock,
- (struct sockaddr *)&this->peerinfo.sockaddr,
+ priv->sock = accept (main_sock,
+ (struct sockaddr *)&this->peerinfo.sockaddr,
&this->peerinfo.sockaddr_len);
if (priv->sock == -1) {
gf_log ("rdma/server", GF_LOG_ERROR,
@@ -4747,7 +4747,7 @@ rdma_listen (rpc_transport_t *this)
goto err;
}
- priv->sock = socket (((struct sockaddr *)&sockaddr)->sa_family,
+ priv->sock = socket (((struct sockaddr *)&sockaddr)->sa_family,
SOCK_STREAM, 0);
if (priv->sock == -1) {
gf_log ("rdma/server", GF_LOG_CRITICAL,
@@ -4761,7 +4761,7 @@ rdma_listen (rpc_transport_t *this)
memcpy (&this->myinfo.sockaddr, &sockaddr, sockaddr_len);
this->myinfo.sockaddr_len = sockaddr_len;
- ret = getnameinfo ((struct sockaddr *)&this->myinfo.sockaddr,
+ ret = getnameinfo ((struct sockaddr *)&this->myinfo.sockaddr,
this->myinfo.sockaddr_len,
host, sizeof (host),
service, sizeof (service),
@@ -4772,7 +4772,7 @@ rdma_listen (rpc_transport_t *this)
goto err;
}
sprintf (this->myinfo.identifier, "%s:%s", host, service);
-
+
setsockopt (priv->sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (opt));
if (bind (priv->sock,
(struct sockaddr *)&sockaddr,
@@ -4794,7 +4794,7 @@ rdma_listen (rpc_transport_t *this)
/* Register the main socket */
priv->idx = event_register (this->ctx->event_pool, priv->sock,
- rdma_server_event_handler,
+ rdma_server_event_handler,
rpc_transport_ref (this), 1, 0);
err:
@@ -4858,51 +4858,51 @@ fini (struct rpc_transport *this)
/* TODO: expand each option */
struct volume_options options[] = {
{ .key = {"transport.rdma.port",
- "rdma-port"},
+ "rdma-port"},
.type = GF_OPTION_TYPE_INT,
.min = 1,
.max = 4,
.description = "check the option by 'ibv_devinfo'"
},
{ .key = {"transport.rdma.mtu",
- "rdma-mtu"},
+ "rdma-mtu"},
.type = GF_OPTION_TYPE_INT,
},
{ .key = {"transport.rdma.device-name",
- "rdma-device-name"},
+ "rdma-device-name"},
.type = GF_OPTION_TYPE_ANY,
.description = "check by 'ibv_devinfo'"
},
{ .key = {"transport.rdma.work-request-send-count",
- "rdma-work-request-send-count"},
+ "rdma-work-request-send-count"},
.type = GF_OPTION_TYPE_INT,
},
{ .key = {"transport.rdma.work-request-recv-count",
- "rdma-work-request-recv-count"},
+ "rdma-work-request-recv-count"},
.type = GF_OPTION_TYPE_INT,
},
- { .key = {"remote-port",
+ { .key = {"remote-port",
"transport.remote-port",
- "transport.rdma.remote-port"},
- .type = GF_OPTION_TYPE_INT
+ "transport.rdma.remote-port"},
+ .type = GF_OPTION_TYPE_INT
},
- { .key = {"transport.rdma.listen-port", "listen-port"},
- .type = GF_OPTION_TYPE_INT
+ { .key = {"transport.rdma.listen-port", "listen-port"},
+ .type = GF_OPTION_TYPE_INT
},
- { .key = {"transport.rdma.connect-path", "connect-path"},
- .type = GF_OPTION_TYPE_ANY
+ { .key = {"transport.rdma.connect-path", "connect-path"},
+ .type = GF_OPTION_TYPE_ANY
},
- { .key = {"transport.rdma.bind-path", "bind-path"},
- .type = GF_OPTION_TYPE_ANY
+ { .key = {"transport.rdma.bind-path", "bind-path"},
+ .type = GF_OPTION_TYPE_ANY
},
- { .key = {"transport.rdma.listen-path", "listen-path"},
- .type = GF_OPTION_TYPE_ANY
+ { .key = {"transport.rdma.listen-path", "listen-path"},
+ .type = GF_OPTION_TYPE_ANY
},
{ .key = {"transport.address-family",
- "address-family"},
+ "address-family"},
.value = {"inet", "inet6", "inet/inet6", "inet6/inet",
"unix", "inet-sdp" },
- .type = GF_OPTION_TYPE_STR
+ .type = GF_OPTION_TYPE_STR
},
{ .key = {"transport.socket.lowlat"},
.type = GF_OPTION_TYPE_BOOL
diff --git a/rpc/rpc-transport/rdma/src/rdma.h b/rpc/rpc-transport/rdma/src/rdma.h
index dbd15d6689e..61cf550d438 100644
--- a/rpc/rpc-transport/rdma/src/rdma.h
+++ b/rpc/rpc-transport/rdma/src/rdma.h
@@ -200,7 +200,7 @@ struct __rdma_ioq {
struct iobref *rsp_iobref;
}request;
- rdma_reply_info_t *reply_info;
+ rdma_reply_info_t *reply_info;
}msg;
struct mem_pool *pool;
@@ -228,7 +228,7 @@ typedef enum __rdma_send_post_type {
RDMA_SEND_POST_RDMA_READ, /* RDMA read */
RDMA_SEND_POST_RDMA_WRITE, /* RDMA write */
}rdma_send_post_type_t;
-
+
/* represents one communication peer, two per transport_t */
struct __rdma_peer {
rpc_transport_t *trans;
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
index 8be29163e23..740f457845e 100644
--- a/rpc/rpc-transport/socket/src/name.c
+++ b/rpc/rpc-transport/socket/src/name.c
@@ -378,20 +378,20 @@ af_inet_server_get_local_sockaddr (rpc_transport_t *this,
{
listen_host = data_to_str (listen_host_data);
} else {
- if (addr->sa_family == AF_INET6) {
- struct sockaddr_in6 *in = (struct sockaddr_in6 *) addr;
- in->sin6_addr = in6addr_any;
- in->sin6_port = htons(listen_port);
- *addr_len = sizeof(struct sockaddr_in6);
+ if (addr->sa_family == AF_INET6) {
+ struct sockaddr_in6 *in = (struct sockaddr_in6 *) addr;
+ in->sin6_addr = in6addr_any;
+ in->sin6_port = htons(listen_port);
+ *addr_len = sizeof(struct sockaddr_in6);
goto out;
- } else if (addr->sa_family == AF_INET) {
- struct sockaddr_in *in = (struct sockaddr_in *) addr;
- in->sin_addr.s_addr = htonl(INADDR_ANY);
- in->sin_port = htons(listen_port);
- *addr_len = sizeof(struct sockaddr_in);
- goto out;
- }
- }
+ } else if (addr->sa_family == AF_INET) {
+ struct sockaddr_in *in = (struct sockaddr_in *) addr;
+ in->sin_addr.s_addr = htonl(INADDR_ANY);
+ in->sin_port = htons(listen_port);
+ *addr_len = sizeof(struct sockaddr_in);
+ goto out;
+ }
+ }
memset (service, 0, sizeof (service));
sprintf (service, "%d", listen_port);
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index cbd303496ae..5744ce29ad2 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -48,90 +48,90 @@
#define SA(ptr) ((struct sockaddr *)ptr)
-#define __socket_proto_reset_pending(priv) do { \
- memset (&priv->incoming.frag.vector, 0, \
- sizeof (priv->incoming.frag.vector)); \
- priv->incoming.frag.pending_vector = \
- &priv->incoming.frag.vector; \
- priv->incoming.frag.pending_vector->iov_base = \
- priv->incoming.frag.fragcurrent; \
- priv->incoming.pending_vector = \
- priv->incoming.frag.pending_vector; \
+#define __socket_proto_reset_pending(priv) do { \
+ memset (&priv->incoming.frag.vector, 0, \
+ sizeof (priv->incoming.frag.vector)); \
+ priv->incoming.frag.pending_vector = \
+ &priv->incoming.frag.vector; \
+ priv->incoming.frag.pending_vector->iov_base = \
+ priv->incoming.frag.fragcurrent; \
+ priv->incoming.pending_vector = \
+ priv->incoming.frag.pending_vector; \
} while (0);
-#define __socket_proto_update_pending(priv) \
- do { \
- uint32_t remaining_fragsize = 0; \
- if (priv->incoming.frag.pending_vector->iov_len == 0) { \
+#define __socket_proto_update_pending(priv) \
+ do { \
+ uint32_t remaining_fragsize = 0; \
+ if (priv->incoming.frag.pending_vector->iov_len == 0) { \
remaining_fragsize = RPC_FRAGSIZE (priv->incoming.fraghdr) \
- - priv->incoming.frag.bytes_read; \
- \
- priv->incoming.frag.pending_vector->iov_len = \
+ - priv->incoming.frag.bytes_read; \
+ \
+ priv->incoming.frag.pending_vector->iov_len = \
remaining_fragsize > priv->incoming.frag.remaining_size \
? priv->incoming.frag.remaining_size : remaining_fragsize; \
- \
- priv->incoming.frag.remaining_size -= \
- priv->incoming.frag.pending_vector->iov_len; \
- } \
+ \
+ priv->incoming.frag.remaining_size -= \
+ priv->incoming.frag.pending_vector->iov_len; \
+ } \
} while (0);
-#define __socket_proto_update_priv_after_read(priv, ret, bytes_read) \
- { \
- priv->incoming.frag.fragcurrent += bytes_read; \
- priv->incoming.frag.bytes_read += bytes_read; \
- \
+#define __socket_proto_update_priv_after_read(priv, ret, bytes_read) \
+ { \
+ priv->incoming.frag.fragcurrent += bytes_read; \
+ priv->incoming.frag.bytes_read += bytes_read; \
+ \
if ((ret > 0) || (priv->incoming.frag.remaining_size != 0)) { \
- if (priv->incoming.frag.remaining_size != 0) { \
- __socket_proto_reset_pending (priv); \
- } \
- \
+ if (priv->incoming.frag.remaining_size != 0) { \
+ __socket_proto_reset_pending (priv); \
+ } \
+ \
gf_log (this->name, GF_LOG_TRACE, "partial read on non-blocking socket"); \
- \
- break; \
- } \
- }
-
-#define __socket_proto_init_pending(priv, size) \
- do { \
- uint32_t remaining_fragsize = 0; \
- remaining_fragsize = RPC_FRAGSIZE (priv->incoming.fraghdr) \
- - priv->incoming.frag.bytes_read; \
- \
- __socket_proto_reset_pending (priv); \
- \
- priv->incoming.frag.pending_vector->iov_len = \
+ \
+ break; \
+ } \
+ }
+
+#define __socket_proto_init_pending(priv, size) \
+ do { \
+ uint32_t remaining_fragsize = 0; \
+ remaining_fragsize = RPC_FRAGSIZE (priv->incoming.fraghdr) \
+ - priv->incoming.frag.bytes_read; \
+ \
+ __socket_proto_reset_pending (priv); \
+ \
+ priv->incoming.frag.pending_vector->iov_len = \
remaining_fragsize > size ? size : remaining_fragsize; \
- \
- priv->incoming.frag.remaining_size = \
- size - priv->incoming.frag.pending_vector->iov_len; \
- \
-} while (0);
+ \
+ priv->incoming.frag.remaining_size = \
+ size - priv->incoming.frag.pending_vector->iov_len; \
+ \
+ } while (0);
/* This will be used in a switch case and breaks from the switch case if all
* the pending data is not read.
*/
-#define __socket_proto_read(priv, ret) \
- { \
- size_t bytes_read = 0; \
- \
- __socket_proto_update_pending (priv); \
- \
- ret = __socket_readv (this, \
- priv->incoming.pending_vector, 1, \
- &priv->incoming.pending_vector, \
- &priv->incoming.pending_count, \
- &bytes_read); \
- if (ret == -1) { \
- gf_log (this->name, GF_LOG_TRACE, \
- "reading from socket failed. Error (%s), " \
- "peer (%s)", strerror (errno), \
- this->peerinfo.identifier); \
- break; \
- } \
+#define __socket_proto_read(priv, ret) \
+ { \
+ size_t bytes_read = 0; \
+ \
+ __socket_proto_update_pending (priv); \
+ \
+ ret = __socket_readv (this, \
+ priv->incoming.pending_vector, 1, \
+ &priv->incoming.pending_vector, \
+ &priv->incoming.pending_count, \
+ &bytes_read); \
+ if (ret == -1) { \
+ gf_log (this->name, GF_LOG_TRACE, \
+ "reading from socket failed. Error (%s), " \
+ "peer (%s)", strerror (errno), \
+ this->peerinfo.identifier); \
+ break; \
+ } \
__socket_proto_update_priv_after_read (priv, ret, bytes_read); \
- }
+ }
int socket_init (rpc_transport_t *this);
@@ -161,8 +161,8 @@ __socket_rwv (rpc_transport_t *this, struct iovec *vector, int count,
priv = this->private;
sock = priv->sock;
- opvector = vector;
- opcount = count;
+ opvector = vector;
+ opcount = count;
if (bytes != NULL) {
*bytes = 0;
@@ -248,7 +248,7 @@ __socket_readv (rpc_transport_t *this, struct iovec *vector, int count,
int ret = -1;
ret = __socket_rwv (this, vector, count,
- pending_vector, pending_count, bytes, 0);
+ pending_vector, pending_count, bytes, 0);
return ret;
}
@@ -261,7 +261,7 @@ __socket_writev (rpc_transport_t *this, struct iovec *vector, int count,
int ret = -1;
ret = __socket_rwv (this, vector, count,
- pending_vector, pending_count, NULL, 1);
+ pending_vector, pending_count, NULL, 1);
return ret;
}
@@ -297,17 +297,17 @@ __socket_server_bind (rpc_transport_t *this)
{
socket_private_t *priv = NULL;
int ret = -1;
- int opt = 1;
+ int opt = 1;
int reuse_check_sock = -1;
struct sockaddr_storage unix_addr = {0};
if (!this || !this->private)
goto out;
- priv = this->private;
+ priv = this->private;
ret = setsockopt (priv->sock, SOL_SOCKET, SO_REUSEADDR,
- &opt, sizeof (opt));
+ &opt, sizeof (opt));
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
@@ -330,7 +330,7 @@ __socket_server_bind (rpc_transport_t *this)
}
ret = bind (priv->sock, (struct sockaddr *)&this->myinfo.sockaddr,
- this->myinfo.sockaddr_len);
+ this->myinfo.sockaddr_len);
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
@@ -369,7 +369,7 @@ __socket_nodelay (int fd)
int ret = -1;
ret = setsockopt (fd, IPPROTO_TCP, TCP_NODELAY,
- &on, sizeof (on));
+ &on, sizeof (on));
if (!ret)
gf_log ("", GF_LOG_TRACE,
"NODELAY enabled for socket %d", fd);
@@ -610,9 +610,9 @@ __socket_ioq_churn_entry (rpc_transport_t *this, struct ioq *entry)
int ret = -1;
ret = __socket_writev (this, entry->pending_vector,
- entry->pending_count,
+ entry->pending_count,
&entry->pending_vector,
- &entry->pending_count);
+ &entry->pending_count);
if (ret == 0) {
/* current entry was completely written */
@@ -649,7 +649,7 @@ __socket_ioq_churn (rpc_transport_t *this)
if (list_empty (&priv->ioq)) {
/* all pending writes done, not interested in POLLOUT */
priv->idx = event_select_on (this->ctx->event_pool,
- priv->sock, priv->idx, -1, 0);
+ priv->sock, priv->idx, -1, 0);
}
out:
@@ -1031,7 +1031,7 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this)
"xdr_sizeof on gfs3_read_rsp failed");
ret = -1;
goto out;
- }
+ }
__socket_proto_init_pending (priv, gluster_read_rsp_hdr_len);
priv->incoming.frag.call_body.reply.accepted_success_state
@@ -1609,21 +1609,21 @@ socket_proto_state_machine (rpc_transport_t *this,
rpc_transport_pollin_t **pollin)
{
socket_private_t *priv = NULL;
- int ret = 0;
+ int ret = 0;
if (!this || !this->private)
goto out;
- priv = this->private;
+ priv = this->private;
- pthread_mutex_lock (&priv->lock);
- {
- ret = __socket_proto_state_machine (this, pollin);
- }
+ pthread_mutex_lock (&priv->lock);
+ {
+ ret = __socket_proto_state_machine (this, pollin);
+ }
pthread_mutex_unlock (&priv->lock);
out:
- return ret;
+ return ret;
}
@@ -1661,51 +1661,51 @@ socket_connect_finish (rpc_transport_t *this)
pthread_mutex_lock (&priv->lock);
{
- if (priv->connected)
- goto unlock;
+ if (priv->connected)
+ goto unlock;
- ret = __socket_connect_finish (priv->sock);
+ ret = __socket_connect_finish (priv->sock);
- if (ret == -1 && errno == EINPROGRESS)
- ret = 1;
+ if (ret == -1 && errno == EINPROGRESS)
+ ret = 1;
- if (ret == -1 && errno != EINPROGRESS) {
- if (!priv->connect_finish_log) {
- gf_log (this->name, GF_LOG_ERROR,
- "connection to %s failed (%s)",
+ if (ret == -1 && errno != EINPROGRESS) {
+ if (!priv->connect_finish_log) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "connection to %s failed (%s)",
this->peerinfo.identifier,
- strerror (errno));
- priv->connect_finish_log = 1;
- }
- __socket_disconnect (this);
- notify_rpc = 1;
- event = RPC_TRANSPORT_DISCONNECT;
- goto unlock;
- }
-
- if (ret == 0) {
- notify_rpc = 1;
-
- this->myinfo.sockaddr_len =
- sizeof (this->myinfo.sockaddr);
-
- ret = getsockname (priv->sock,
- SA (&this->myinfo.sockaddr),
- &this->myinfo.sockaddr_len);
- if (ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "getsockname on (%d) failed (%s)",
- priv->sock, strerror (errno));
- __socket_disconnect (this);
- event = GF_EVENT_POLLERR;
- goto unlock;
- }
-
- priv->connected = 1;
- priv->connect_finish_log = 0;
- event = RPC_TRANSPORT_CONNECT;
- get_transport_identifiers (this);
- }
+ strerror (errno));
+ priv->connect_finish_log = 1;
+ }
+ __socket_disconnect (this);
+ notify_rpc = 1;
+ event = RPC_TRANSPORT_DISCONNECT;
+ goto unlock;
+ }
+
+ if (ret == 0) {
+ notify_rpc = 1;
+
+ this->myinfo.sockaddr_len =
+ sizeof (this->myinfo.sockaddr);
+
+ ret = getsockname (priv->sock,
+ SA (&this->myinfo.sockaddr),
+ &this->myinfo.sockaddr_len);
+ if (ret == -1) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "getsockname on (%d) failed (%s)",
+ priv->sock, strerror (errno));
+ __socket_disconnect (this);
+ event = GF_EVENT_POLLERR;
+ goto unlock;
+ }
+
+ priv->connected = 1;
+ priv->connect_finish_log = 0;
+ event = RPC_TRANSPORT_CONNECT;
+ get_transport_identifiers (this);
+ }
}
unlock:
pthread_mutex_unlock (&priv->lock);
@@ -1776,7 +1776,7 @@ socket_server_event_handler (int fd, int idx, void *data,
struct sockaddr_storage new_sockaddr = {0, };
socklen_t addrlen = sizeof (new_sockaddr);
socket_private_t *new_priv = NULL;
- glusterfs_ctx_t *ctx = NULL;
+ glusterfs_ctx_t *ctx = NULL;
this = data;
if (!this || !this->private || !this->xl)
@@ -1784,7 +1784,7 @@ socket_server_event_handler (int fd, int idx, void *data,
THIS = this->xl;
priv = this->private;
- ctx = this->ctx;
+ ctx = this->ctx;
pthread_mutex_lock (&priv->lock);
{
@@ -1792,7 +1792,7 @@ socket_server_event_handler (int fd, int idx, void *data,
if (poll_in) {
new_sock = accept (priv->sock, SA (&new_sockaddr),
- &addrlen);
+ &addrlen);
if (new_sock == -1)
goto unlock;
@@ -1838,11 +1838,11 @@ socket_server_event_handler (int fd, int idx, void *data,
new_trans->name = gf_strdup (this->name);
memcpy (&new_trans->peerinfo.sockaddr, &new_sockaddr,
- addrlen);
+ addrlen);
new_trans->peerinfo.sockaddr_len = addrlen;
new_trans->myinfo.sockaddr_len =
- sizeof (new_trans->myinfo.sockaddr);
+ sizeof (new_trans->myinfo.sockaddr);
ret = getsockname (new_sock,
SA (&new_trans->myinfo.sockaddr),
@@ -1874,10 +1874,10 @@ socket_server_event_handler (int fd, int idx, void *data,
rpc_transport_ref (new_trans);
new_priv->idx =
- event_register (ctx->event_pool,
- new_sock,
- socket_event_handler,
- new_trans, 1, 0);
+ event_register (ctx->event_pool,
+ new_sock,
+ socket_event_handler,
+ new_trans, 1, 0);
if (new_priv->idx == -1)
ret = -1;
@@ -1924,18 +1924,18 @@ int
socket_connect (rpc_transport_t *this, int port)
{
int ret = -1;
- int sock = -1;
+ int sock = -1;
socket_private_t *priv = NULL;
struct sockaddr_storage sockaddr = {0, };
socklen_t sockaddr_len = 0;
- glusterfs_ctx_t *ctx = NULL;
+ glusterfs_ctx_t *ctx = NULL;
sa_family_t sa_family = {0, };
if (!this || !this->private)
goto err;
priv = this->private;
- ctx = this->ctx;
+ ctx = this->ctx;
if (!priv) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -1981,7 +1981,7 @@ socket_connect (rpc_transport_t *this, int port)
if (priv->sock == -1) {
gf_log (this->name, GF_LOG_ERROR,
"socket creation failed (%s)",
- strerror (errno));
+ strerror (errno));
goto unlock;
}
@@ -2040,10 +2040,10 @@ socket_connect (rpc_transport_t *this, int port)
}
SA (&this->myinfo.sockaddr)->sa_family =
- SA (&this->peerinfo.sockaddr)->sa_family;
+ SA (&this->peerinfo.sockaddr)->sa_family;
ret = client_bind (this, SA (&this->myinfo.sockaddr),
- &this->myinfo.sockaddr_len, priv->sock);
+ &this->myinfo.sockaddr_len, priv->sock);
if (ret == -1) {
gf_log (this->name, GF_LOG_WARNING,
"client bind failed: %s", strerror (errno));
@@ -2053,12 +2053,12 @@ socket_connect (rpc_transport_t *this, int port)
}
ret = connect (priv->sock, SA (&this->peerinfo.sockaddr),
- this->peerinfo.sockaddr_len);
+ this->peerinfo.sockaddr_len);
if (ret == -1 && errno != EINPROGRESS) {
gf_log (this->name, GF_LOG_ERROR,
"connection attempt failed (%s)",
- strerror (errno));
+ strerror (errno));
close (priv->sock);
priv->sock = -1;
goto unlock;
@@ -2086,19 +2086,19 @@ socket_listen (rpc_transport_t *this)
{
socket_private_t * priv = NULL;
int ret = -1;
- int sock = -1;
+ int sock = -1;
struct sockaddr_storage sockaddr;
socklen_t sockaddr_len;
peer_info_t *myinfo = NULL;
- glusterfs_ctx_t *ctx = NULL;
+ glusterfs_ctx_t *ctx = NULL;
sa_family_t sa_family = {0, };
if (!this || !this->private)
goto out;
- priv = this->private;
- myinfo = &this->myinfo;
- ctx = this->ctx;
+ priv = this->private;
+ myinfo = &this->myinfo;
+ ctx = this->ctx;
pthread_mutex_lock (&priv->lock);
{
@@ -2134,7 +2134,7 @@ socket_listen (rpc_transport_t *this)
if (priv->sock == -1) {
gf_log (this->name, GF_LOG_ERROR,
"socket creation failed (%s)",
- strerror (errno));
+ strerror (errno));
goto unlock;
}
@@ -2195,7 +2195,7 @@ socket_listen (rpc_transport_t *this)
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
"could not set socket %d to listen mode (%s)",
- priv->sock, strerror (errno));
+ priv->sock, strerror (errno));
close (priv->sock);
priv->sock = -1;
goto unlock;
@@ -2205,12 +2205,12 @@ socket_listen (rpc_transport_t *this)
priv->idx = event_register (ctx->event_pool, priv->sock,
socket_server_event_handler,
- this, 1, 0);
+ this, 1, 0);
if (priv->idx == -1) {
gf_log (this->name, GF_LOG_DEBUG,
"could not register socket %d with events",
- priv->sock);
+ priv->sock);
ret = -1;
close (priv->sock);
priv->sock = -1;
@@ -2233,13 +2233,13 @@ socket_submit_request (rpc_transport_t *this, rpc_transport_req_t *req)
char need_poll_out = 0;
char need_append = 1;
struct ioq *entry = NULL;
- glusterfs_ctx_t *ctx = NULL;
+ glusterfs_ctx_t *ctx = NULL;
if (!this || !this->private)
goto out;
priv = this->private;
- ctx = this->ctx;
+ ctx = this->ctx;
pthread_mutex_lock (&priv->lock);
{
@@ -2276,7 +2276,7 @@ socket_submit_request (rpc_transport_t *this, rpc_transport_req_t *req)
if (need_poll_out) {
/* first entry to wait. continue writing on POLLOUT */
priv->idx = event_select_on (ctx->event_pool,
- priv->sock,
+ priv->sock,
priv->idx, -1, 1);
}
}
@@ -2296,13 +2296,13 @@ socket_submit_reply (rpc_transport_t *this, rpc_transport_reply_t *reply)
char need_poll_out = 0;
char need_append = 1;
struct ioq *entry = NULL;
- glusterfs_ctx_t *ctx = NULL;
+ glusterfs_ctx_t *ctx = NULL;
if (!this || !this->private)
goto out;
priv = this->private;
- ctx = this->ctx;
+ ctx = this->ctx;
pthread_mutex_lock (&priv->lock);
{
@@ -2337,7 +2337,7 @@ socket_submit_reply (rpc_transport_t *this, rpc_transport_reply_t *reply)
if (need_poll_out) {
/* first entry to wait. continue writing on POLLOUT */
priv->idx = event_select_on (ctx->event_pool,
- priv->sock,
+ priv->sock,
priv->idx, -1, 1);
}
}
@@ -2450,22 +2450,22 @@ validate_options (rpc_transport_t *this, dict_t *options, char **op_errstr)
char *optstr = NULL;
int ret = -1;
gf_boolean_t tmp_bool = _gf_false;
-
+
if (dict_get_str (options, "transport.socket.keepalive",
- &optstr) == 0) {
- if (gf_string2boolean (optstr, &tmp_bool) == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "'transport.socket.keepalive' takes only "
- "boolean options, not taking any action");
- *op_errstr = "Value should be only boolean!!";
- ret =-1;
- goto out;
- }
+ &optstr) == 0) {
+ if (gf_string2boolean (optstr, &tmp_bool) == -1) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "'transport.socket.keepalive' takes only "
+ "boolean options, not taking any action");
+ *op_errstr = "Value should be only boolean!!";
+ ret =-1;
+ goto out;
+ }
}
ret =0;
out:
- return ret;
+ return ret;
}
@@ -2481,22 +2481,22 @@ reconfigure (rpc_transport_t *this, dict_t *options)
ret =-1;
goto out;
}
-
-
+
+
priv = this->private;
if (dict_get_str (this->options, "transport.socket.keepalive",
- &optstr) == 0) {
- if (gf_string2boolean (optstr, &tmp_bool) == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "'transport.socket.keepalive' takes only "
- "boolean options, not taking any action");
- priv->keepalive = 1;
- goto out;
- }
- gf_log (this->name, GF_LOG_DEBUG, "Reconfigured transport.socket.keepalive");
-
- priv->keepalive = tmp_bool;
+ &optstr) == 0) {
+ if (gf_string2boolean (optstr, &tmp_bool) == -1) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "'transport.socket.keepalive' takes only "
+ "boolean options, not taking any action");
+ priv->keepalive = 1;
+ goto out;
+ }
+ gf_log (this->name, GF_LOG_DEBUG, "Reconfigured transport.socket.keepalive");
+
+ priv->keepalive = tmp_bool;
}
else
priv->keepalive = 1;
@@ -2525,7 +2525,7 @@ socket_init (rpc_transport_t *this)
if (!priv) {
gf_log (this->name, GF_LOG_ERROR,
"calloc (1, %"GF_PRI_SIZET") returned NULL",
- sizeof (*priv));
+ sizeof (*priv));
return -1;
}
@@ -2551,7 +2551,7 @@ socket_init (rpc_transport_t *this)
if (gf_string2boolean (optstr, &tmp_bool) == -1) {
gf_log (this->name, GF_LOG_ERROR,
"'non-blocking-io' takes only boolean options,"
- " not taking any action");
+ " not taking any action");
tmp_bool = 1;
}
@@ -2604,7 +2604,7 @@ socket_init (rpc_transport_t *this)
if (gf_string2boolean (optstr, &tmp_bool) == -1) {
gf_log (this->name, GF_LOG_ERROR,
"'transport.socket.keepalive' takes only "
- "boolean options, not taking any action");
+ "boolean options, not taking any action");
tmp_bool = 1;
}
diff --git a/rpc/rpc-transport/socket/src/socket.h b/rpc/rpc-transport/socket/src/socket.h
index c43c5576c3b..0bdc95db5c9 100644
--- a/rpc/rpc-transport/socket/src/socket.h
+++ b/rpc/rpc-transport/socket/src/socket.h
@@ -88,8 +88,8 @@ typedef enum {
SP_STATE_REQUEST_HEADER_INIT,
SP_STATE_READING_RPCHDR1,
SP_STATE_READ_RPCHDR1, /* read msg from beginning till and
- * including credlen
- */
+ * including credlen
+ */
} sp_rpcfrag_request_header_state_t;
struct ioq {