Commit dc8228d1 authored by Philipp Reisner's avatar Philipp Reisner

drbd: Converted drbd_send_protocol() from mdev to tconn

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 13e6037d
...@@ -1161,7 +1161,7 @@ extern void _tl_add_barrier(struct drbd_conf *, struct drbd_tl_epoch *); ...@@ -1161,7 +1161,7 @@ extern void _tl_add_barrier(struct drbd_conf *, struct drbd_tl_epoch *);
extern void drbd_free_sock(struct drbd_conf *mdev); extern void drbd_free_sock(struct drbd_conf *mdev);
extern int drbd_send(struct drbd_tconn *tconn, struct socket *sock, extern int drbd_send(struct drbd_tconn *tconn, struct socket *sock,
void *buf, size_t size, unsigned msg_flags); void *buf, size_t size, unsigned msg_flags);
extern int drbd_send_protocol(struct drbd_conf *mdev); extern int drbd_send_protocol(struct drbd_tconn *tconn);
extern int drbd_send_uuids(struct drbd_conf *mdev); extern int drbd_send_uuids(struct drbd_conf *mdev);
extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev); extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev);
extern int drbd_gen_and_send_sync_uuid(struct drbd_conf *mdev); extern int drbd_gen_and_send_sync_uuid(struct drbd_conf *mdev);
......
...@@ -796,15 +796,15 @@ int drbd_send_sync_param(struct drbd_conf *mdev, struct syncer_conf *sc) ...@@ -796,15 +796,15 @@ int drbd_send_sync_param(struct drbd_conf *mdev, struct syncer_conf *sc)
return rv; return rv;
} }
int drbd_send_protocol(struct drbd_conf *mdev) int drbd_send_protocol(struct drbd_tconn *tconn)
{ {
struct p_protocol *p; struct p_protocol *p;
int size, cf, rv; int size, cf, rv;
size = sizeof(struct p_protocol); size = sizeof(struct p_protocol);
if (mdev->tconn->agreed_pro_version >= 87) if (tconn->agreed_pro_version >= 87)
size += strlen(mdev->tconn->net_conf->integrity_alg) + 1; size += strlen(tconn->net_conf->integrity_alg) + 1;
/* we must not recurse into our own queue, /* we must not recurse into our own queue,
* as that is blocked during handshake */ * as that is blocked during handshake */
...@@ -812,30 +812,30 @@ int drbd_send_protocol(struct drbd_conf *mdev) ...@@ -812,30 +812,30 @@ int drbd_send_protocol(struct drbd_conf *mdev)
if (p == NULL) if (p == NULL)
return 0; return 0;
p->protocol = cpu_to_be32(mdev->tconn->net_conf->wire_protocol); p->protocol = cpu_to_be32(tconn->net_conf->wire_protocol);
p->after_sb_0p = cpu_to_be32(mdev->tconn->net_conf->after_sb_0p); p->after_sb_0p = cpu_to_be32(tconn->net_conf->after_sb_0p);
p->after_sb_1p = cpu_to_be32(mdev->tconn->net_conf->after_sb_1p); p->after_sb_1p = cpu_to_be32(tconn->net_conf->after_sb_1p);
p->after_sb_2p = cpu_to_be32(mdev->tconn->net_conf->after_sb_2p); p->after_sb_2p = cpu_to_be32(tconn->net_conf->after_sb_2p);
p->two_primaries = cpu_to_be32(mdev->tconn->net_conf->two_primaries); p->two_primaries = cpu_to_be32(tconn->net_conf->two_primaries);
cf = 0; cf = 0;
if (mdev->tconn->net_conf->want_lose) if (tconn->net_conf->want_lose)
cf |= CF_WANT_LOSE; cf |= CF_WANT_LOSE;
if (mdev->tconn->net_conf->dry_run) { if (tconn->net_conf->dry_run) {
if (mdev->tconn->agreed_pro_version >= 92) if (tconn->agreed_pro_version >= 92)
cf |= CF_DRY_RUN; cf |= CF_DRY_RUN;
else { else {
dev_err(DEV, "--dry-run is not supported by peer"); conn_err(tconn, "--dry-run is not supported by peer");
kfree(p); kfree(p);
return -1; return -1;
} }
} }
p->conn_flags = cpu_to_be32(cf); p->conn_flags = cpu_to_be32(cf);
if (mdev->tconn->agreed_pro_version >= 87) if (tconn->agreed_pro_version >= 87)
strcpy(p->integrity_alg, mdev->tconn->net_conf->integrity_alg); strcpy(p->integrity_alg, tconn->net_conf->integrity_alg);
rv = drbd_send_cmd(mdev, USE_DATA_SOCKET, P_PROTOCOL, &p->head, size); rv = conn_send_cmd2(tconn, P_PROTOCOL, p->head.payload, size - sizeof(struct p_header));
kfree(p); kfree(p);
return rv; return rv;
} }
......
...@@ -910,7 +910,7 @@ static int drbd_connect(struct drbd_conf *mdev) ...@@ -910,7 +910,7 @@ static int drbd_connect(struct drbd_conf *mdev)
drbd_thread_start(&mdev->tconn->asender); drbd_thread_start(&mdev->tconn->asender);
if (drbd_send_protocol(mdev) == -1) if (drbd_send_protocol(mdev->tconn) == -1)
return -1; return -1;
drbd_send_sync_param(mdev, &mdev->sync_conf); drbd_send_sync_param(mdev, &mdev->sync_conf);
drbd_send_sizes(mdev, 0, 0); drbd_send_sizes(mdev, 0, 0);
......
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