Skip to content

Commit

Permalink
dlm: use TCP_NODELAY
Browse files Browse the repository at this point in the history
Nagling doesn't help and can sometimes hurt dlm comms.

Signed-off-by: David Teigland <[email protected]>
  • Loading branch information
teigland committed Nov 12, 2010
1 parent dcce240 commit cb2d45d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fs/dlm/lowcomms.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,7 @@ static void tcp_connect_to_sock(struct connection *con)
struct sockaddr_storage saddr, src_addr;
int addr_len;
struct socket *sock = NULL;
int one = 1;

if (con->nodeid == 0) {
log_print("attempt to connect sock 0 foiled");
Expand Down Expand Up @@ -971,6 +972,11 @@ static void tcp_connect_to_sock(struct connection *con)
make_sockaddr(&saddr, dlm_config.ci_tcp_port, &addr_len);

log_print("connecting to %d", con->nodeid);

/* Turn off Nagle's algorithm */
kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, (char *)&one,
sizeof(one));

result =
sock->ops->connect(sock, (struct sockaddr *)&saddr, addr_len,
O_NONBLOCK);
Expand Down Expand Up @@ -1022,6 +1028,10 @@ static struct socket *tcp_create_listen_sock(struct connection *con,
goto create_out;
}

/* Turn off Nagle's algorithm */
kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, (char *)&one,
sizeof(one));

result = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(char *)&one, sizeof(one));

Expand Down

0 comments on commit cb2d45d

Please sign in to comment.