Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 422028b1 authored by Philipp Reisner's avatar Philipp Reisner
Browse files

drbd: New configuration parameters for dealing with network congestion



net {
    on_congestion {block|pull-ahead|disconnect};
    congestion-fill {sectors};
    congestion-extents {al-extents};
}

Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
parent 759fbdfb
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1323,6 +1323,8 @@ static int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
	new_conf->wire_protocol    = DRBD_PROT_C;
	new_conf->ping_timeo	   = DRBD_PING_TIMEO_DEF;
	new_conf->rr_conflict	   = DRBD_RR_CONFLICT_DEF;
	new_conf->on_congestion    = DRBD_ON_CONGESTION_DEF;
	new_conf->cong_extents     = DRBD_CONG_EXTENTS_DEF;

	if (!net_conf_from_tags(mdev, nlp->tag_list, new_conf)) {
		retcode = ERR_MANDATORY_TAG;
@@ -1344,6 +1346,11 @@ static int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
		}
	}

	if (new_conf->on_congestion != OC_BLOCK && new_conf->wire_protocol != DRBD_PROT_A) {
		retcode = ERR_CONG_NOT_PROTO_A;
		goto fail;
	}

	if (mdev->state.role == R_PRIMARY && new_conf->want_lose) {
		retcode = ERR_DISCARD;
		goto fail;
+7 −0
Original line number Diff line number Diff line
@@ -96,6 +96,12 @@ enum drbd_on_no_data {
	OND_SUSPEND_IO
};

enum drbd_on_congestion {
	OC_BLOCK,
	OC_PULL_AHEAD,
	OC_DISCONNECT,
};

/* KEEP the order, do not delete or insert. Only append. */
enum drbd_ret_codes {
	ERR_CODE_BASE		= 100,
@@ -146,6 +152,7 @@ enum drbd_ret_codes {
	ERR_PERM		= 152,
	ERR_NEED_APV_93		= 153,
	ERR_STONITH_AND_PROT_A  = 154,
	ERR_CONG_NOT_PROTO_A	= 155,

	/* insert new ones above this line */
	AFTER_LAST_ERR_CODE
+9 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@
#define DRBD_AFTER_SB_2P_DEF ASB_DISCONNECT
#define DRBD_RR_CONFLICT_DEF ASB_DISCONNECT
#define DRBD_ON_NO_DATA_DEF OND_IO_ERROR
#define DRBD_ON_CONGESTION_DEF OC_BLOCK

#define DRBD_MAX_BIO_BVECS_MIN 0
#define DRBD_MAX_BIO_BVECS_MAX 128
@@ -154,5 +155,13 @@
#define DRBD_C_MIN_RATE_MAX     (4 << 20)
#define DRBD_C_MIN_RATE_DEF     4096

#define DRBD_CONG_FILL_MIN	0
#define DRBD_CONG_FILL_MAX	(10<<21) /* 10GByte in sectors */
#define DRBD_CONG_FILL_DEF	0

#define DRBD_CONG_EXTENTS_MIN	DRBD_AL_EXTENTS_MIN
#define DRBD_CONG_EXTENTS_MAX	DRBD_AL_EXTENTS_MAX
#define DRBD_CONG_EXTENTS_DEF	DRBD_AL_EXTENTS_DEF

#undef RANGE
#endif
+3 −0
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@ NL_PACKET(net_conf, 5,
	NL_INTEGER(	39,	T_MAY_IGNORE,	rr_conflict)
	NL_INTEGER(	40,	T_MAY_IGNORE,	ping_timeo)
	NL_INTEGER(	67,	T_MAY_IGNORE,	rcvbuf_size)
	NL_INTEGER(	81,	T_MAY_IGNORE,	on_congestion)
	NL_INTEGER(	82,	T_MAY_IGNORE,	cong_fill)
	NL_INTEGER(	83,	T_MAY_IGNORE,	cong_extents)
	  /* 59 addr_family was available in GIT, never released */
	NL_BIT(		60,	T_MANDATORY,	mind_af)
	NL_BIT(		27,	T_MAY_IGNORE,	want_lose)