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 11/14] drbd: A small cleanup in drbdd()
Date: Wed, 7 Sep 2011 16:17:38 +0200 [thread overview]
Message-ID: <1315405061-1473-12-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1315405061-1473-1-git-send-email-philipp.reisner@linbit.com>
From: Andreas Gruenbacher <agruen@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 | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 57e65ac..a4b24f9 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3943,18 +3943,20 @@ static void drbdd(struct drbd_tconn *tconn)
int err;
while (get_t_state(&tconn->receiver) == RUNNING) {
+ struct data_cmd *cmd;
+
drbd_thread_current_set_cpu(&tconn->receiver);
if (drbd_recv_header(tconn, &pi))
goto err_out;
- if (unlikely(pi.cmd >= ARRAY_SIZE(drbd_cmd_handler) ||
- !drbd_cmd_handler[pi.cmd].mdev_fn)) {
+ cmd = &drbd_cmd_handler[pi.cmd];
+ if (unlikely(pi.cmd >= ARRAY_SIZE(drbd_cmd_handler) || !cmd->mdev_fn)) {
conn_err(tconn, "unknown packet type %d, l: %d!\n", pi.cmd, pi.size);
goto err_out;
}
- shs = drbd_cmd_handler[pi.cmd].pkt_size - sizeof(struct p_header);
- if (pi.size - shs > 0 && !drbd_cmd_handler[pi.cmd].expect_payload) {
+ shs = cmd->pkt_size - sizeof(struct p_header);
+ if (pi.size - shs > 0 && !cmd->expect_payload) {
conn_err(tconn, "No payload expected %s l:%d\n", cmdname(pi.cmd), pi.size);
goto err_out;
}
@@ -3965,12 +3967,12 @@ static void drbdd(struct drbd_tconn *tconn)
goto err_out;
}
- if (drbd_cmd_handler[pi.cmd].fa_type == CONN) {
- err = drbd_cmd_handler[pi.cmd].conn_fn(tconn, pi.cmd, pi.size - shs);
+ if (cmd->fa_type == CONN) {
+ err = cmd->conn_fn(tconn, pi.cmd, pi.size - shs);
} else {
struct drbd_conf *mdev = vnr_to_mdev(tconn, pi.vnr);
err = mdev ?
- drbd_cmd_handler[pi.cmd].mdev_fn(mdev, pi.cmd, pi.size - shs) :
+ cmd->mdev_fn(mdev, pi.cmd, pi.size - shs) :
tconn_receive_skip(tconn, pi.cmd, pi.size - shs);
}
--
1.7.4.1
next prev parent reply other threads:[~2011-09-07 16:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-07 14:17 [RFC 00/14] drbd: part 7 of adding multiple volume support to drbd Philipp Reisner
2011-09-07 14:17 ` [PATCH 01/14] drbd: drbd_connected(): Return an error code upon failure Philipp Reisner
2011-09-07 14:17 ` [PATCH 02/14] drbd: Always use the same protocol version for the same peer Philipp Reisner
2011-09-07 14:17 ` [PATCH 03/14] drbd: Move drbd_send_ping() and drbd_send_ping_ack() to drbd_main.c Philipp Reisner
2011-09-07 14:17 ` [PATCH 04/14] drbd: Make _drbd_send_bitmap() static Philipp Reisner
2011-09-07 14:17 ` [PATCH 05/14] drbd: Rename the DCBP_* functions to dcbp_* and move them to where they are used Philipp Reisner
2011-09-07 14:17 ` [PATCH 06/14] drbd: Converted drbd_try_outdate_peer() from mdev to tconn Philipp Reisner
2011-09-07 14:17 ` [PATCH 07/14] drbd: Preallocate one page per drbd_socket as a receive buffer Philipp Reisner
2011-09-07 14:17 ` [PATCH 08/14] drbd: receive_bitmap(): Use the pre-allocated " Philipp Reisner
2011-09-07 14:17 ` [PATCH 09/14] drbd: Preallocate one page per drbd_socket as a send buffer Philipp Reisner
2011-09-07 14:17 ` [PATCH 10/14] drbd: _drbd_send_bitmap(): Use the pre-allocated " Philipp Reisner
2011-09-07 14:17 ` Philipp Reisner [this message]
2011-09-07 14:17 ` [PATCH 12/14] drbd: Remove useless error messages Philipp Reisner
2011-09-07 14:17 ` [PATCH 13/14] drbd: Pass struct packet_info down to the receive functions Philipp Reisner
2011-09-07 14:17 ` [PATCH 14/14] drbd: Map from (connection, volume number) to device in the receive handlers 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=1315405061-1473-12-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®