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 09/14] drbd: Preallocate one page per drbd_socket as a send buffer
Date: Wed, 7 Sep 2011 16:17:36 +0200 [thread overview]
Message-ID: <1315405061-1473-10-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_int.h | 23 +----------------------
drivers/block/drbd/drbd_main.c | 6 +++++-
drivers/block/drbd/drbd_receiver.c | 4 ++--
drivers/block/drbd/drbd_worker.c | 2 +-
4 files changed, 9 insertions(+), 26 deletions(-)
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 4a4ecec..984b2a3 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -556,27 +556,6 @@ struct p_delay_probe93 {
#define DRBD_SOCKET_BUFFER_SIZE 4096
-union p_polymorph {
- struct p_header header;
- struct p_handshake handshake;
- struct p_data data;
- struct p_block_ack block_ack;
- struct p_barrier barrier;
- struct p_barrier_ack barrier_ack;
- struct p_rs_param_89 rs_param_89;
- struct p_rs_param_95 rs_param_95;
- struct p_protocol protocol;
- struct p_sizes sizes;
- struct p_uuids uuids;
- struct p_state state;
- struct p_req_state req_state;
- struct p_req_state_reply req_state_reply;
- struct p_block_req block_req;
- struct p_delay_probe93 delay_probe93;
- struct p_rs_uuid rs_uuid;
- struct p_block_desc block_desc;
-} __packed;
-
/**********************************************************************/
enum drbd_thread_state {
NONE,
@@ -804,7 +783,7 @@ struct drbd_socket {
struct socket *socket;
/* this way we get our
* send/receive buffers off the stack */
- union p_polymorph sbuf;
+ void *sbuf;
void *rbuf;
};
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 7b6da0e..6c2a51f 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -800,7 +800,7 @@ int drbd_send_sync_param(struct drbd_conf *mdev)
enum drbd_packet cmd =
apv >= 89 ? P_SYNC_PARAM89 : P_SYNC_PARAM;
- p = &mdev->tconn->data.sbuf.rs_param_95;
+ p = mdev->tconn->data.sbuf;
/* initialize verify_alg and csums_alg */
memset(p->verify_alg, 0, 2 * SHARED_SECRET_MAX);
@@ -2279,11 +2279,15 @@ static int drbd_alloc_socket(struct drbd_socket *socket)
socket->rbuf = (void *) __get_free_page(GFP_KERNEL);
if (!socket->rbuf)
return -ENOMEM;
+ socket->sbuf = (void *) __get_free_page(GFP_KERNEL);
+ if (!socket->sbuf)
+ return -ENOMEM;
return 0;
}
static void drbd_free_socket(struct drbd_socket *socket)
{
+ free_page((unsigned long) socket->sbuf);
free_page((unsigned long) socket->rbuf);
}
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index e5099db..57e65ac 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -736,7 +736,7 @@ out:
static int drbd_send_fp(struct drbd_tconn *tconn, struct socket *sock, enum drbd_packet cmd)
{
- struct p_header *h = &tconn->data.sbuf.header;
+ struct p_header *h = tconn->data.sbuf;
return !_conn_send_cmd(tconn, 0, sock, cmd, h, sizeof(*h), 0);
}
@@ -4136,7 +4136,7 @@ static int drbd_disconnected(int vnr, void *p, void *data)
static int drbd_send_handshake(struct drbd_tconn *tconn)
{
/* ASSERT current == mdev->tconn->receiver ... */
- struct p_handshake *p = &tconn->data.sbuf.handshake;
+ struct p_handshake *p = tconn->data.sbuf;
int err;
if (mutex_lock_interruptible(&tconn->data.mutex)) {
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index e96a816..ed12cdf 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -1195,7 +1195,7 @@ int w_send_barrier(struct drbd_work *w, int cancel)
{
struct drbd_tl_epoch *b = container_of(w, struct drbd_tl_epoch, w);
struct drbd_conf *mdev = w->mdev;
- struct p_barrier *p = &mdev->tconn->data.sbuf.barrier;
+ struct p_barrier *p = mdev->tconn->data.sbuf;
int err = 0;
/* really avoid racing with tl_clear. w.cb may have been referenced
--
1.7.4.1
next prev parent reply other threads:[~2011-09-07 16:50 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 ` Philipp Reisner [this message]
2011-09-07 14:17 ` [PATCH 10/14] drbd: _drbd_send_bitmap(): Use the pre-allocated send buffer Philipp Reisner
2011-09-07 14:17 ` [PATCH 11/14] drbd: A small cleanup in drbdd() Philipp Reisner
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-10-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®