drbd: New sync_param packet, that includes the parameters of the new controller
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
parent
9a31d7164d
commit
8e26f9ccb9
@ -451,6 +451,17 @@ struct p_rs_param_89 {
|
||||
char csums_alg[SHARED_SECRET_MAX];
|
||||
} __packed;
|
||||
|
||||
struct p_rs_param_95 {
|
||||
struct p_header head;
|
||||
u32 rate;
|
||||
char verify_alg[SHARED_SECRET_MAX];
|
||||
char csums_alg[SHARED_SECRET_MAX];
|
||||
u32 c_plan_ahead;
|
||||
u32 c_delay_target;
|
||||
u32 c_fill_target;
|
||||
u32 c_max_rate;
|
||||
} __packed;
|
||||
|
||||
enum drbd_conn_flags {
|
||||
CF_WANT_LOSE = 1,
|
||||
CF_DRY_RUN = 2,
|
||||
@ -610,6 +621,7 @@ union p_polymorph {
|
||||
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;
|
||||
@ -1268,6 +1280,8 @@ struct bm_extent {
|
||||
* Bit 1 ==> local node thinks this block needs to be synced.
|
||||
*/
|
||||
|
||||
#define SLEEP_TIME (HZ/10)
|
||||
|
||||
#define BM_BLOCK_SHIFT 12 /* 4k per bit */
|
||||
#define BM_BLOCK_SIZE (1<<BM_BLOCK_SHIFT)
|
||||
/* (9+3) : 512 bytes @ 8 bits; representing 16M storage
|
||||
|
@ -1713,7 +1713,7 @@ int drbd_send_cmd2(struct drbd_conf *mdev, enum drbd_packets cmd, char *data,
|
||||
|
||||
int drbd_send_sync_param(struct drbd_conf *mdev, struct syncer_conf *sc)
|
||||
{
|
||||
struct p_rs_param_89 *p;
|
||||
struct p_rs_param_95 *p;
|
||||
struct socket *sock;
|
||||
int size, rv;
|
||||
const int apv = mdev->agreed_pro_version;
|
||||
@ -1721,7 +1721,8 @@ int drbd_send_sync_param(struct drbd_conf *mdev, struct syncer_conf *sc)
|
||||
size = apv <= 87 ? sizeof(struct p_rs_param)
|
||||
: apv == 88 ? sizeof(struct p_rs_param)
|
||||
+ strlen(mdev->sync_conf.verify_alg) + 1
|
||||
: /* 89 */ sizeof(struct p_rs_param_89);
|
||||
: apv <= 94 ? sizeof(struct p_rs_param_89)
|
||||
: /* apv >= 95 */ sizeof(struct p_rs_param_95);
|
||||
|
||||
/* used from admin command context and receiver/worker context.
|
||||
* to avoid kmalloc, grab the socket right here,
|
||||
@ -1732,12 +1733,16 @@ int drbd_send_sync_param(struct drbd_conf *mdev, struct syncer_conf *sc)
|
||||
if (likely(sock != NULL)) {
|
||||
enum drbd_packets cmd = apv >= 89 ? P_SYNC_PARAM89 : P_SYNC_PARAM;
|
||||
|
||||
p = &mdev->data.sbuf.rs_param_89;
|
||||
p = &mdev->data.sbuf.rs_param_95;
|
||||
|
||||
/* initialize verify_alg and csums_alg */
|
||||
memset(p->verify_alg, 0, 2 * SHARED_SECRET_MAX);
|
||||
|
||||
p->rate = cpu_to_be32(sc->rate);
|
||||
p->c_plan_ahead = cpu_to_be32(sc->c_plan_ahead);
|
||||
p->c_delay_target = cpu_to_be32(sc->c_delay_target);
|
||||
p->c_fill_target = cpu_to_be32(sc->c_fill_target);
|
||||
p->c_max_rate = cpu_to_be32(sc->c_max_rate);
|
||||
|
||||
if (apv >= 88)
|
||||
strcpy(p->verify_alg, mdev->sync_conf.verify_alg);
|
||||
|
@ -2805,7 +2805,7 @@ struct crypto_hash *drbd_crypto_alloc_digest_safe(const struct drbd_conf *mdev,
|
||||
static int receive_SyncParam(struct drbd_conf *mdev, struct p_header *h)
|
||||
{
|
||||
int ok = TRUE;
|
||||
struct p_rs_param_89 *p = (struct p_rs_param_89 *)h;
|
||||
struct p_rs_param_95 *p = (struct p_rs_param_95 *)h;
|
||||
unsigned int header_size, data_size, exp_max_sz;
|
||||
struct crypto_hash *verify_tfm = NULL;
|
||||
struct crypto_hash *csums_tfm = NULL;
|
||||
@ -2814,7 +2814,8 @@ static int receive_SyncParam(struct drbd_conf *mdev, struct p_header *h)
|
||||
exp_max_sz = apv <= 87 ? sizeof(struct p_rs_param)
|
||||
: apv == 88 ? sizeof(struct p_rs_param)
|
||||
+ SHARED_SECRET_MAX
|
||||
: /* 89 */ sizeof(struct p_rs_param_89);
|
||||
: apv <= 94 ? sizeof(struct p_rs_param_89)
|
||||
: /* apv >= 95 */ sizeof(struct p_rs_param_95);
|
||||
|
||||
if (h->length > exp_max_sz) {
|
||||
dev_err(DEV, "SyncParam packet too long: received %u, expected <= %u bytes\n",
|
||||
@ -2825,10 +2826,14 @@ static int receive_SyncParam(struct drbd_conf *mdev, struct p_header *h)
|
||||
if (apv <= 88) {
|
||||
header_size = sizeof(struct p_rs_param) - sizeof(*h);
|
||||
data_size = h->length - header_size;
|
||||
} else /* apv >= 89 */ {
|
||||
} else if (apv <= 94) {
|
||||
header_size = sizeof(struct p_rs_param_89) - sizeof(*h);
|
||||
data_size = h->length - header_size;
|
||||
D_ASSERT(data_size == 0);
|
||||
} else {
|
||||
header_size = sizeof(struct p_rs_param_95) - sizeof(*h);
|
||||
data_size = h->length - header_size;
|
||||
D_ASSERT(data_size == 0);
|
||||
}
|
||||
|
||||
/* initialize verify_alg and csums_alg */
|
||||
@ -2893,6 +2898,13 @@ static int receive_SyncParam(struct drbd_conf *mdev, struct p_header *h)
|
||||
}
|
||||
}
|
||||
|
||||
if (apv > 94) {
|
||||
mdev->sync_conf.rate = be32_to_cpu(p->rate);
|
||||
mdev->sync_conf.c_plan_ahead = be32_to_cpu(p->c_plan_ahead);
|
||||
mdev->sync_conf.c_delay_target = be32_to_cpu(p->c_delay_target);
|
||||
mdev->sync_conf.c_fill_target = be32_to_cpu(p->c_fill_target);
|
||||
mdev->sync_conf.c_max_rate = be32_to_cpu(p->c_max_rate);
|
||||
}
|
||||
|
||||
spin_lock(&mdev->peer_seq_lock);
|
||||
/* lock against drbd_nl_syncer_conf() */
|
||||
|
@ -39,8 +39,6 @@
|
||||
#include "drbd_int.h"
|
||||
#include "drbd_req.h"
|
||||
|
||||
#define SLEEP_TIME (HZ/10)
|
||||
|
||||
static int w_make_ov_request(struct drbd_conf *mdev, struct drbd_work *w, int cancel);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user