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 03/13] drbd: Made cmp_after_sb() more generic into convert_after_sb()
Date: Mon, 10 Oct 2011 13:54:56 +0200 [thread overview]
Message-ID: <1318247706-7732-4-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1318247706-7732-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 | 25 +++++++++----------------
1 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 7deade1..b5eeb8d 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -2984,25 +2984,18 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev, enum drbd_rol
return rv;
}
-/* returns 1 if invalid */
-static int cmp_after_sb(enum drbd_after_sb_p peer, enum drbd_after_sb_p self)
+static enum drbd_after_sb_p convert_after_sb(enum drbd_after_sb_p peer)
{
/* ASB_DISCARD_REMOTE - ASB_DISCARD_LOCAL is valid */
- if ((peer == ASB_DISCARD_REMOTE && self == ASB_DISCARD_LOCAL) ||
- (self == ASB_DISCARD_REMOTE && peer == ASB_DISCARD_LOCAL))
- return 0;
+ if (peer == ASB_DISCARD_REMOTE)
+ return ASB_DISCARD_LOCAL;
/* any other things with ASB_DISCARD_REMOTE or ASB_DISCARD_LOCAL are invalid */
- if (peer == ASB_DISCARD_REMOTE || peer == ASB_DISCARD_LOCAL ||
- self == ASB_DISCARD_REMOTE || self == ASB_DISCARD_LOCAL)
- return 1;
+ if (peer == ASB_DISCARD_LOCAL)
+ return ASB_DISCARD_REMOTE;
/* everything else is valid if they are equal on both sides. */
- if (peer == self)
- return 0;
-
- /* everything es is invalid. */
- return 1;
+ return peer;
}
static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
@@ -3060,17 +3053,17 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
goto disconnect_rcu_unlock;
}
- if (cmp_after_sb(p_after_sb_0p, nc->after_sb_0p)) {
+ if (convert_after_sb(p_after_sb_0p) != nc->after_sb_0p) {
conn_err(tconn, "incompatible after-sb-0pri settings\n");
goto disconnect_rcu_unlock;
}
- if (cmp_after_sb(p_after_sb_1p, nc->after_sb_1p)) {
+ if (convert_after_sb(p_after_sb_1p) != nc->after_sb_1p) {
conn_err(tconn, "incompatible after-sb-1pri settings\n");
goto disconnect_rcu_unlock;
}
- if (cmp_after_sb(p_after_sb_2p, nc->after_sb_2p)) {
+ if (convert_after_sb(p_after_sb_2p) != nc->after_sb_2p) {
conn_err(tconn, "incompatible after-sb-2pri settings\n");
goto disconnect_rcu_unlock;
}
--
1.7.4.1
next prev parent reply other threads:[~2011-10-10 11:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-10 11:54 [RFC 00/13] drbd: part 17 of adding multiple volume support to drbd Philipp Reisner
2011-10-10 11:54 ` [PATCH 01/13] drbd: Refuse to change network options online when Philipp Reisner
2011-10-10 11:54 ` [PATCH 02/13] drbd: protect updates to integrits_tfm by tconn->data->mutex Philipp Reisner
2011-10-10 11:54 ` Philipp Reisner [this message]
2011-10-10 11:54 ` [PATCH 04/13] drbd: Allocation of int_dig_in and int_dig_vv was missing Philipp Reisner
2011-10-10 11:54 ` [PATCH 05/13] drbd: Receiving part for the PROTOCOL_UPDATE packet Philipp Reisner
2011-10-10 11:54 ` [PATCH 06/13] drbd: Send PROTOCOL_UPDATE packets when appropriate Philipp Reisner
2011-10-10 11:55 ` [PATCH 07/13] drbd: Use more generic constant names Philipp Reisner
2011-10-10 11:55 ` [PATCH 08/13] drbd: Output signed / unsigned netlink fields correctly Philipp Reisner
2011-10-10 11:55 ` [PATCH 09/13] drbd: Remove unused GENLA_F_MAY_IGNORE flag Philipp Reisner
2011-10-10 11:55 ` [PATCH 10/13] drbd: Make drbd's use of netlink attribute flags less confusing Philipp Reisner
2011-10-10 11:55 ` [PATCH 11/13] drbd: drbd_nla_check_mandatory(): Need to remove the DRBD_GENLA_F_MANDATORY flag first Philipp Reisner
2011-10-10 11:55 ` [PATCH 12/13] drbd: drbd_adm_prepare(): Pass through error codes Philipp Reisner
2011-10-10 11:55 ` [PATCH 13/13] drbd: Don't use empty nested netlink attributes 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=1318247706-7732-4-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
Powered by JetHome