Commit dbd9eea0 authored by Philipp Reisner's avatar Philipp Reisner

drbd: Removed unused mdev argument from drbd_recv_short() and drbd_socket_okay()

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent d38e787e
...@@ -476,8 +476,7 @@ static int drbd_accept(const char **what, struct socket *sock, struct socket **n ...@@ -476,8 +476,7 @@ static int drbd_accept(const char **what, struct socket *sock, struct socket **n
return err; return err;
} }
static int drbd_recv_short(struct drbd_conf *mdev, struct socket *sock, static int drbd_recv_short(struct socket *sock, void *buf, size_t size, int flags)
void *buf, size_t size, int flags)
{ {
mm_segment_t oldfs; mm_segment_t oldfs;
struct kvec iov = { struct kvec iov = {
...@@ -710,7 +709,7 @@ static enum drbd_packet drbd_recv_fp(struct drbd_conf *mdev, struct socket *sock ...@@ -710,7 +709,7 @@ static enum drbd_packet drbd_recv_fp(struct drbd_conf *mdev, struct socket *sock
struct p_header80 *h = &mdev->tconn->data.rbuf.header.h80; struct p_header80 *h = &mdev->tconn->data.rbuf.header.h80;
int rr; int rr;
rr = drbd_recv_short(mdev, sock, h, sizeof(*h), 0); rr = drbd_recv_short(sock, h, sizeof(*h), 0);
if (rr == sizeof(*h) && h->magic == cpu_to_be32(DRBD_MAGIC)) if (rr == sizeof(*h) && h->magic == cpu_to_be32(DRBD_MAGIC))
return be16_to_cpu(h->command); return be16_to_cpu(h->command);
...@@ -720,10 +719,9 @@ static enum drbd_packet drbd_recv_fp(struct drbd_conf *mdev, struct socket *sock ...@@ -720,10 +719,9 @@ static enum drbd_packet drbd_recv_fp(struct drbd_conf *mdev, struct socket *sock
/** /**
* drbd_socket_okay() - Free the socket if its connection is not okay * drbd_socket_okay() - Free the socket if its connection is not okay
* @mdev: DRBD device.
* @sock: pointer to the pointer to the socket. * @sock: pointer to the pointer to the socket.
*/ */
static int drbd_socket_okay(struct drbd_conf *mdev, struct socket **sock) static int drbd_socket_okay(struct socket **sock)
{ {
int rr; int rr;
char tb[4]; char tb[4];
...@@ -731,7 +729,7 @@ static int drbd_socket_okay(struct drbd_conf *mdev, struct socket **sock) ...@@ -731,7 +729,7 @@ static int drbd_socket_okay(struct drbd_conf *mdev, struct socket **sock)
if (!*sock) if (!*sock)
return false; return false;
rr = drbd_recv_short(mdev, *sock, tb, 4, MSG_DONTWAIT | MSG_PEEK); rr = drbd_recv_short(*sock, tb, 4, MSG_DONTWAIT | MSG_PEEK);
if (rr > 0 || rr == -EAGAIN) { if (rr > 0 || rr == -EAGAIN) {
return true; return true;
...@@ -795,8 +793,8 @@ static int drbd_connect(struct drbd_conf *mdev) ...@@ -795,8 +793,8 @@ static int drbd_connect(struct drbd_conf *mdev)
if (sock && msock) { if (sock && msock) {
schedule_timeout_interruptible(mdev->tconn->net_conf->ping_timeo*HZ/10); schedule_timeout_interruptible(mdev->tconn->net_conf->ping_timeo*HZ/10);
ok = drbd_socket_okay(mdev, &sock); ok = drbd_socket_okay(&sock);
ok = drbd_socket_okay(mdev, &msock) && ok; ok = drbd_socket_okay(&msock) && ok;
if (ok) if (ok)
break; break;
} }
...@@ -805,8 +803,8 @@ static int drbd_connect(struct drbd_conf *mdev) ...@@ -805,8 +803,8 @@ static int drbd_connect(struct drbd_conf *mdev)
s = drbd_wait_for_connect(mdev->tconn); s = drbd_wait_for_connect(mdev->tconn);
if (s) { if (s) {
try = drbd_recv_fp(mdev, s); try = drbd_recv_fp(mdev, s);
drbd_socket_okay(mdev, &sock); drbd_socket_okay(&sock);
drbd_socket_okay(mdev, &msock); drbd_socket_okay(&msock);
switch (try) { switch (try) {
case P_HAND_SHAKE_S: case P_HAND_SHAKE_S:
if (sock) { if (sock) {
...@@ -841,8 +839,8 @@ static int drbd_connect(struct drbd_conf *mdev) ...@@ -841,8 +839,8 @@ static int drbd_connect(struct drbd_conf *mdev)
} }
if (sock && msock) { if (sock && msock) {
ok = drbd_socket_okay(mdev, &sock); ok = drbd_socket_okay(&sock);
ok = drbd_socket_okay(mdev, &msock) && ok; ok = drbd_socket_okay(&msock) && ok;
if (ok) if (ok)
break; break;
} }
...@@ -4601,8 +4599,7 @@ int drbd_asender(struct drbd_thread *thi) ...@@ -4601,8 +4599,7 @@ int drbd_asender(struct drbd_thread *thi)
if (signal_pending(current)) if (signal_pending(current))
continue; continue;
rv = drbd_recv_short(mdev, mdev->tconn->meta.socket, rv = drbd_recv_short(mdev->tconn->meta.socket, buf, expect-received, 0);
buf, expect-received, 0);
clear_bit(SIGNAL_ASENDER, &mdev->tconn->flags); clear_bit(SIGNAL_ASENDER, &mdev->tconn->flags);
flush_signals(current); flush_signals(current);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment