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>
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 004a8ce..16ec6c3 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -800,7 +800,7 @@
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 @@
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);
}