diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-02-07 11:35:59 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2011-09-28 04:32:58 -0400 |
commit | 65d11ed6f2430498bf3735d40a9e243409780fb1 (patch) | |
tree | 945e4f714eb39d9cbda2ac14237afa94b53072dd /drivers/block/drbd/drbd_receiver.c | |
parent | 9ba7aa00ae574714c4decf8f3e0dcdb679a3239e (diff) |
drbd: Converted drbd_do_handshake() from mdev to tconn
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index ebd8320d123d..0a4d15c913e7 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -60,7 +60,7 @@ enum finish_epoch { | |||
60 | FE_RECYCLED, | 60 | FE_RECYCLED, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static int drbd_do_handshake(struct drbd_conf *mdev); | 63 | static int drbd_do_handshake(struct drbd_tconn *tconn); |
64 | static int drbd_do_auth(struct drbd_conf *mdev); | 64 | static int drbd_do_auth(struct drbd_conf *mdev); |
65 | 65 | ||
66 | static enum finish_epoch drbd_may_finish_epoch(struct drbd_conf *, struct drbd_epoch *, enum epoch_event); | 66 | static enum finish_epoch drbd_may_finish_epoch(struct drbd_conf *, struct drbd_epoch *, enum epoch_event); |
@@ -883,7 +883,7 @@ retry: | |||
883 | 883 | ||
884 | D_ASSERT(mdev->tconn->asender.task == NULL); | 884 | D_ASSERT(mdev->tconn->asender.task == NULL); |
885 | 885 | ||
886 | h = drbd_do_handshake(mdev); | 886 | h = drbd_do_handshake(mdev->tconn); |
887 | if (h <= 0) | 887 | if (h <= 0) |
888 | return h; | 888 | return h; |
889 | 889 | ||
@@ -3991,39 +3991,39 @@ static int drbd_send_handshake(struct drbd_tconn *tconn) | |||
3991 | * -1 peer talks different language, | 3991 | * -1 peer talks different language, |
3992 | * no point in trying again, please go standalone. | 3992 | * no point in trying again, please go standalone. |
3993 | */ | 3993 | */ |
3994 | static int drbd_do_handshake(struct drbd_conf *mdev) | 3994 | static int drbd_do_handshake(struct drbd_tconn *tconn) |
3995 | { | 3995 | { |
3996 | /* ASSERT current == mdev->tconn->receiver ... */ | 3996 | /* ASSERT current == tconn->receiver ... */ |
3997 | struct p_handshake *p = &mdev->tconn->data.rbuf.handshake; | 3997 | struct p_handshake *p = &tconn->data.rbuf.handshake; |
3998 | const int expect = sizeof(struct p_handshake) - sizeof(struct p_header80); | 3998 | const int expect = sizeof(struct p_handshake) - sizeof(struct p_header80); |
3999 | struct packet_info pi; | 3999 | struct packet_info pi; |
4000 | int rv; | 4000 | int rv; |
4001 | 4001 | ||
4002 | rv = drbd_send_handshake(mdev->tconn); | 4002 | rv = drbd_send_handshake(tconn); |
4003 | if (!rv) | 4003 | if (!rv) |
4004 | return 0; | 4004 | return 0; |
4005 | 4005 | ||
4006 | rv = drbd_recv_header(mdev->tconn, &pi); | 4006 | rv = drbd_recv_header(tconn, &pi); |
4007 | if (!rv) | 4007 | if (!rv) |
4008 | return 0; | 4008 | return 0; |
4009 | 4009 | ||
4010 | if (pi.cmd != P_HAND_SHAKE) { | 4010 | if (pi.cmd != P_HAND_SHAKE) { |
4011 | dev_err(DEV, "expected HandShake packet, received: %s (0x%04x)\n", | 4011 | conn_err(tconn, "expected HandShake packet, received: %s (0x%04x)\n", |
4012 | cmdname(pi.cmd), pi.cmd); | 4012 | cmdname(pi.cmd), pi.cmd); |
4013 | return -1; | 4013 | return -1; |
4014 | } | 4014 | } |
4015 | 4015 | ||
4016 | if (pi.size != expect) { | 4016 | if (pi.size != expect) { |
4017 | dev_err(DEV, "expected HandShake length: %u, received: %u\n", | 4017 | conn_err(tconn, "expected HandShake length: %u, received: %u\n", |
4018 | expect, pi.size); | 4018 | expect, pi.size); |
4019 | return -1; | 4019 | return -1; |
4020 | } | 4020 | } |
4021 | 4021 | ||
4022 | rv = drbd_recv(mdev->tconn, &p->head.payload, expect); | 4022 | rv = drbd_recv(tconn, &p->head.payload, expect); |
4023 | 4023 | ||
4024 | if (rv != expect) { | 4024 | if (rv != expect) { |
4025 | if (!signal_pending(current)) | 4025 | if (!signal_pending(current)) |
4026 | dev_warn(DEV, "short read receiving handshake packet: l=%u\n", rv); | 4026 | conn_warn(tconn, "short read receiving handshake packet: l=%u\n", rv); |
4027 | return 0; | 4027 | return 0; |
4028 | } | 4028 | } |
4029 | 4029 | ||
@@ -4036,15 +4036,15 @@ static int drbd_do_handshake(struct drbd_conf *mdev) | |||
4036 | PRO_VERSION_MIN > p->protocol_max) | 4036 | PRO_VERSION_MIN > p->protocol_max) |
4037 | goto incompat; | 4037 | goto incompat; |
4038 | 4038 | ||
4039 | mdev->tconn->agreed_pro_version = min_t(int, PRO_VERSION_MAX, p->protocol_max); | 4039 | tconn->agreed_pro_version = min_t(int, PRO_VERSION_MAX, p->protocol_max); |
4040 | 4040 | ||
4041 | dev_info(DEV, "Handshake successful: " | 4041 | conn_info(tconn, "Handshake successful: " |
4042 | "Agreed network protocol version %d\n", mdev->tconn->agreed_pro_version); | 4042 | "Agreed network protocol version %d\n", tconn->agreed_pro_version); |
4043 | 4043 | ||
4044 | return 1; | 4044 | return 1; |
4045 | 4045 | ||
4046 | incompat: | 4046 | incompat: |
4047 | dev_err(DEV, "incompatible DRBD dialects: " | 4047 | conn_err(tconn, "incompatible DRBD dialects: " |
4048 | "I support %d-%d, peer supports %d-%d\n", | 4048 | "I support %d-%d, peer supports %d-%d\n", |
4049 | PRO_VERSION_MIN, PRO_VERSION_MAX, | 4049 | PRO_VERSION_MIN, PRO_VERSION_MAX, |
4050 | p->protocol_min, p->protocol_max); | 4050 | p->protocol_min, p->protocol_max); |