From: Philipp Reisner <philipp.reisner@linbit.com>
To: linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Cc: drbd-dev@lists.linbit.com
Subject: [PATCH 07/16] drbd: Converted receive_protocol() from mdev to tconn
Date: Fri, 2 Sep 2011 12:00:39 +0200 [thread overview]
Message-ID: <1314957648-13242-8-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1314957648-13242-1-git-send-email-philipp.reisner@linbit.com>
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
drivers/block/drbd/drbd_receiver.c | 46 ++++++++++++++++++------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 1301ba1..17904f7 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -2856,10 +2856,10 @@ static int cmp_after_sb(enum drbd_after_sb_p peer, enum drbd_after_sb_p self)
return 1;
}
-static int receive_protocol(struct drbd_conf *mdev, enum drbd_packet cmd,
+static int receive_protocol(struct drbd_tconn *tconn, enum drbd_packet cmd,
unsigned int data_size)
{
- struct p_protocol *p = &mdev->tconn->data.rbuf.protocol;
+ struct p_protocol *p = &tconn->data.rbuf.protocol;
int p_proto, p_after_sb_0p, p_after_sb_1p, p_after_sb_2p;
int p_want_lose, p_two_primaries, cf;
char p_integrity_alg[SHARED_SECRET_MAX] = "";
@@ -2872,60 +2872,60 @@ static int receive_protocol(struct drbd_conf *mdev, enum drbd_packet cmd,
cf = be32_to_cpu(p->conn_flags);
p_want_lose = cf & CF_WANT_LOSE;
- clear_bit(CONN_DRY_RUN, &mdev->tconn->flags);
+ clear_bit(CONN_DRY_RUN, &tconn->flags);
if (cf & CF_DRY_RUN)
- set_bit(CONN_DRY_RUN, &mdev->tconn->flags);
+ set_bit(CONN_DRY_RUN, &tconn->flags);
- if (p_proto != mdev->tconn->net_conf->wire_protocol) {
- dev_err(DEV, "incompatible communication protocols\n");
+ if (p_proto != tconn->net_conf->wire_protocol) {
+ conn_err(tconn, "incompatible communication protocols\n");
goto disconnect;
}
- if (cmp_after_sb(p_after_sb_0p, mdev->tconn->net_conf->after_sb_0p)) {
- dev_err(DEV, "incompatible after-sb-0pri settings\n");
+ if (cmp_after_sb(p_after_sb_0p, tconn->net_conf->after_sb_0p)) {
+ conn_err(tconn, "incompatible after-sb-0pri settings\n");
goto disconnect;
}
- if (cmp_after_sb(p_after_sb_1p, mdev->tconn->net_conf->after_sb_1p)) {
- dev_err(DEV, "incompatible after-sb-1pri settings\n");
+ if (cmp_after_sb(p_after_sb_1p, tconn->net_conf->after_sb_1p)) {
+ conn_err(tconn, "incompatible after-sb-1pri settings\n");
goto disconnect;
}
- if (cmp_after_sb(p_after_sb_2p, mdev->tconn->net_conf->after_sb_2p)) {
- dev_err(DEV, "incompatible after-sb-2pri settings\n");
+ if (cmp_after_sb(p_after_sb_2p, tconn->net_conf->after_sb_2p)) {
+ conn_err(tconn, "incompatible after-sb-2pri settings\n");
goto disconnect;
}
- if (p_want_lose && mdev->tconn->net_conf->want_lose) {
- dev_err(DEV, "both sides have the 'want_lose' flag set\n");
+ if (p_want_lose && tconn->net_conf->want_lose) {
+ conn_err(tconn, "both sides have the 'want_lose' flag set\n");
goto disconnect;
}
- if (p_two_primaries != mdev->tconn->net_conf->two_primaries) {
- dev_err(DEV, "incompatible setting of the two-primaries options\n");
+ if (p_two_primaries != tconn->net_conf->two_primaries) {
+ conn_err(tconn, "incompatible setting of the two-primaries options\n");
goto disconnect;
}
- if (mdev->tconn->agreed_pro_version >= 87) {
- unsigned char *my_alg = mdev->tconn->net_conf->integrity_alg;
+ if (tconn->agreed_pro_version >= 87) {
+ unsigned char *my_alg = tconn->net_conf->integrity_alg;
- if (drbd_recv(mdev->tconn, p_integrity_alg, data_size) != data_size)
+ if (drbd_recv(tconn, p_integrity_alg, data_size) != data_size)
return false;
p_integrity_alg[SHARED_SECRET_MAX-1] = 0;
if (strcmp(p_integrity_alg, my_alg)) {
- dev_err(DEV, "incompatible setting of the data-integrity-alg\n");
+ conn_err(tconn, "incompatible setting of the data-integrity-alg\n");
goto disconnect;
}
- dev_info(DEV, "data-integrity-alg: %s\n",
+ conn_info(tconn, "data-integrity-alg: %s\n",
my_alg[0] ? my_alg : (unsigned char *)"<not-used>");
}
return true;
disconnect:
- conn_request_state(mdev->tconn, NS(conn, C_DISCONNECTING), CS_HARD);
+ conn_request_state(tconn, NS(conn, C_DISCONNECTING), CS_HARD);
return false;
}
@@ -3883,7 +3883,7 @@ static struct data_cmd drbd_cmd_handler[] = {
[P_RS_DATA_REQUEST] = { 0, sizeof(struct p_block_req), MDEV, { receive_DataRequest } },
[P_SYNC_PARAM] = { 1, sizeof(struct p_header), MDEV, { receive_SyncParam } },
[P_SYNC_PARAM89] = { 1, sizeof(struct p_header), MDEV, { receive_SyncParam } },
- [P_PROTOCOL] = { 1, sizeof(struct p_protocol), MDEV, { receive_protocol } },
+ [P_PROTOCOL] = { 1, sizeof(struct p_protocol), CONN, { .conn_fn = receive_protocol } },
[P_UUIDS] = { 0, sizeof(struct p_uuids), MDEV, { receive_uuids } },
[P_SIZES] = { 0, sizeof(struct p_sizes), MDEV, { receive_sizes } },
[P_STATE] = { 0, sizeof(struct p_state), MDEV, { receive_state } },
--
1.7.4.1
next prev parent reply other threads:[~2011-09-02 10:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-02 10:00 [RFC 00/16] drbd: part 5 of adding multiple volume support to drbd Philipp Reisner
2011-09-02 10:00 ` [PATCH 01/16] drbd: process_done_ee() has to handle unconfigured devices now Philipp Reisner
2011-09-02 10:00 ` [PATCH 02/16] drbd: New minors have to intherit the connection state form their connection Philipp Reisner
2011-09-02 10:00 ` [PATCH 03/16] drbd: Allow two diskless minors to be connected Philipp Reisner
2011-09-02 10:00 ` [PATCH 04/16] drbd: Do not modify the connection state with something else that conn_request_state() Philipp Reisner
2011-09-02 10:00 ` [PATCH 05/16] drbd: Moved CONN_DRY_RUN to the per connection (tconn) flags Philipp Reisner
2011-09-02 10:00 ` [PATCH 06/16] drbd: Allow packet handler functions that take a connection Philipp Reisner
2011-09-02 10:00 ` Philipp Reisner [this message]
2011-09-02 10:00 ` [PATCH 08/16] drbd: Separate connection state changes from minor dev state changes #1 Philipp Reisner
2011-09-02 10:00 ` [PATCH 09/16] drbd: Allow packet handler functions that take a connection (meta connection) Philipp Reisner
2011-09-02 10:00 ` [PATCH 10/16] drbd: Converted got_Ping() and got_PingAck() from mdev to tconn Philipp Reisner
2011-09-02 10:00 ` [PATCH 11/16] drbd: Separate connection state changes from minor dev state changes #2 Philipp Reisner
2011-09-02 10:00 ` [PATCH 12/16] drbd: fix conn_reconfig_start without conn_reconfig_done in drbd_adm_attach Philipp Reisner
2011-09-02 10:00 ` [PATCH 13/16] drbd: Allow volumes to become primary only on one side Philipp Reisner
2011-09-02 10:00 ` [PATCH 14/16] drbd: conn_khelper() for user mode callbacks for connections Philipp Reisner
2011-09-02 10:00 ` [PATCH 15/16] drbd: distribute former syncer_conf settings to disk, connection, and resource level Philipp Reisner
2011-09-02 10:00 ` [PATCH 16/16] drbd: Fixed conn_lowest_minor Philipp Reisner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1314957648-13242-8-git-send-email-philipp.reisner@linbit.com \
--to=philipp.reisner@linbit.com \
--cc=axboe@kernel.dk \
--cc=drbd-dev@lists.linbit.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®