mirror of
https://github.com/torvalds/linux.git
synced 2024-10-30 00:32:38 +00:00
drbd: Preallocate one page per drbd_socket as a send buffer
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
parent
fc56815c81
commit
5a87d920f3
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
@ -2277,11 +2277,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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
@ -4138,7 +4138,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)) {
|
||||
|
@ -1193,7 +1193,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
|
||||
|
Loading…
Reference in New Issue
Block a user