drbd: New configuration parameters for dealing with network congestion
authorPhilipp Reisner <philipp.reisner@linbit.com>
Wed, 27 Oct 2010 09:12:07 +0000 (11:12 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 10 Mar 2011 10:34:45 +0000 (11:34 +0100)
net {
    on_congestion {block|pull-ahead|disconnect};
    congestion-fill {sectors};
    congestion-extents {al-extents};
}

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_nl.c
include/linux/drbd.h
include/linux/drbd_limits.h
include/linux/drbd_nl.h

index 9e27d82..f969d87 100644 (file)
@@ -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;
index ef44c7a..03a08ba 100644 (file)
@@ -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
index 4ac33f3..abf4187 100644 (file)
 #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
 #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
index ade9110..8cde394 100644 (file)
@@ -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)