[libmultipath] extend the scope of the "rr_min_io" keyword to hwe and mpe
authorChristophe Varoqui <root@xa-s05.(none)>
Wed, 16 Nov 2005 16:24:48 +0000 (17:24 +0100)
committerChristophe Varoqui <root@xa-s05.(none)>
Wed, 16 Nov 2005 16:24:48 +0000 (17:24 +0100)
Can now specify per device instance or device type rr repeat counts in
the config file.

Edward Goggin, EMC, and me.

libmultipath/config.h
libmultipath/dict.c
libmultipath/dmparser.c
libmultipath/propsel.c
libmultipath/propsel.h
libmultipath/structs.h
multipath.conf.annotated
multipath.conf.synthetic
multipath/main.c

index 9908926..f0064f6 100644 (file)
@@ -19,6 +19,7 @@ struct hwentry {
        int pgfailback;
        int rr_weight;
        int no_path_retry;
+       int minio;
 
        char * vendor;
        char * product;
@@ -35,6 +36,7 @@ struct mpentry {
        int pgfailback;
        int rr_weight;
        int no_path_retry;
+       int minio;
 
        char * wwid;
        char * selector;
index 5a7bf96..4c668bf 100644 (file)
@@ -501,6 +501,26 @@ hw_no_path_retry_handler(vector strvec)
        return 0;
 }
 
+static int
+hw_minio_handler(vector strvec)
+{
+       struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
+       char * buff;
+
+       if (!hwe)
+               return 1;
+
+       buff = set_value(strvec);
+
+       if (!buff)
+               return 1;
+
+       hwe->minio = atoi(buff);
+       FREE(buff);
+
+       return 0;
+}
+
 /*
  * multipaths block handlers
  */
@@ -672,6 +692,26 @@ mp_no_path_retry_handler(vector strvec)
        return 0;
 }
 
+static int
+mp_minio_handler(vector strvec)
+{
+       struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
+       char * buff;
+
+       if (!mpe)
+               return 1;
+
+       buff = set_value(strvec);
+
+       if (!buff)
+               return 1;
+
+       mpe->minio = atoi(buff);
+       FREE(buff);
+
+       return 0;
+}
+
 vector
 init_keywords(void)
 {
@@ -721,6 +761,7 @@ init_keywords(void)
        install_keyword("failback", &hw_failback_handler);
        install_keyword("rr_weight", &hw_weight_handler);
        install_keyword("no_path_retry", &hw_no_path_retry_handler);
+       install_keyword("rr_min_io", &hw_minio_handler);
        install_sublevel_end();
 
        install_keyword_root("multipaths", &multipaths_handler);
@@ -733,6 +774,7 @@ init_keywords(void)
        install_keyword("failback", &mp_failback_handler);
        install_keyword("rr_weight", &mp_weight_handler);
        install_keyword("no_path_retry", &mp_no_path_retry_handler);
+       install_keyword("rr_min_io", &mp_minio_handler);
        install_sublevel_end();
 
        return keywords;
index a26c800..e3716aa 100644 (file)
@@ -234,7 +234,19 @@ disassemble_map (vector pathvec, char * params, struct multipath * mpp)
                        pp->pgindex = i + 1;
 
                        for (k = 0; k < num_paths_args; k++)
-                               p += get_word(p, NULL);
+                               if (k == 0 && !strncmp(mpp->selector,
+                                                      "round-robin", 11)) {
+                                       p += get_word(p, &word);
+                                       mpp->minio = atoi(word);
+
+                                       if (mpp->rr_weight)
+                                               mpp->minio /= mpp->rr_weight;
+
+                                       FREE(word);
+                               }
+                               else
+                                       p += get_word(p, NULL);
+
                }
        }
        return 0;
index 29c7a4c..1c7b12b 100644 (file)
@@ -243,3 +243,31 @@ select_no_path_retry(struct multipath *mp)
        condlog(3, "no_path_retry = NONE (internal default)");
        return 0;
 }
+
+extern int
+select_minio (struct multipath * mp)
+{
+       if (mp->mpe && mp->mpe->minio) {
+               mp->minio = mp->mpe->minio;
+               condlog(3, "minio = %i (LUN setting)",
+                       mp->minio);
+               return 0;
+       }
+       if (mp->hwe && mp->hwe->minio) {
+               mp->minio = mp->hwe->minio;
+               condlog(3, "minio = %i (controler setting)",
+                       mp->minio);
+               return 0;
+       }
+       if (conf->minio) {
+               mp->minio = conf->minio;
+               condlog(3, "minio = %i (config file default)",
+                       mp->minio);
+               return 0;
+       }
+       mp->minio = 1000;
+       condlog(3, "minio = %i (internal default)",
+               mp->minio);
+       return 0;
+}
+
index e5124d0..d4b3367 100644 (file)
@@ -9,3 +9,4 @@ int select_checkfn(struct path *pp);
 int select_getuid (struct path * pp);
 int select_getprio (struct path * pp);
 int select_no_path_retry(struct multipath *mp);
+int select_minio(struct multipath *mp);
index 3bcb5b9..d53f04e 100644 (file)
@@ -122,6 +122,7 @@ struct multipath {
        int nr_active;     /* current available(= not known as failed) paths */
        int no_path_retry; /* number of retries after all paths are down */
        int retry_tick;    /* remaining times for retries */
+       int minio;
        unsigned long long size;
        vector paths;
        vector pg;
index 2ca13ba..808972f 100644 (file)
 #              # default : (null)
 #              #
 #              #no_path_retry  queue
+#
+#              #
+#              # name    : rr_min_io
+#              # scope   : multipath
+#              # desc    : the number of IO to route to a path before switching
+#              #           to the next in the same path group
+#              # default : 1000
+#              #
+#              rr_min_io       100
 #      }
 #      multipath {
 #              wwid    1DEC_____321816758474
 #              # default : immediate
 #              #
 #              failback                30
+#
+#              #
+#              # name    : rr_min_io
+#              # scope   : multipath
+#              # desc    : the number of IO to route to a path before switching
+#              #           to the next in the same path group
+#              # default : 1000
+#              #
+#              rr_min_io       100
 #      }
 #      device {
 #              vendor                  "COMPAQ  "
index 190b175..334800b 100644 (file)
@@ -32,6 +32,7 @@
 #              failback                manual
 #              rr_weight               priorities
 #              no_path_retry           5
+#              rr_min_io               100
 #      }
 #      multipath {
 #              wwid                    1DEC_____321816758474
@@ -50,6 +51,7 @@
 #              failback                15
 #              rr_weight               priorities
 #              no_path_retry           queue
+#              rr_min_io               100
 #      }
 #      device {
 #              vendor                  "COMPAQ  "
index b4a2eaa..94326a7 100644 (file)
@@ -318,6 +318,7 @@ assemble_map (struct multipath * mp)
        struct pathgroup * pgp;
        struct path * pp;
 
+       minio = mp->minio;
        p = mp->params;
        freechar = sizeof(mp->params);
        
@@ -344,8 +345,6 @@ assemble_map (struct multipath * mp)
                freechar -= shift;
 
                vector_foreach_slot (pgp->paths, pp, j) {
-                       minio = conf->minio;
-                       
                        if (mp->rr_weight == RR_WEIGHT_PRIO && pp->priority)
                                minio *= pp->priority;
 
@@ -391,6 +390,7 @@ setup_map (struct multipath * mpp)
        select_hwhandler(mpp);
        select_rr_weight(mpp);
        select_no_path_retry(mpp);
+       select_minio(mpp);
 
        /*
         * apply selected grouping policy to valid paths
@@ -544,6 +544,12 @@ select_action (struct multipath * mpp, vector curmp)
                condlog(3, "set ACT_RELOAD: selector change");
                return;
        }
+       if (cmpp->minio != mpp->minio) {
+               mpp->action = ACT_RELOAD;
+               condlog(3, "set ACT_RELOAD: minio change (%u->%u)",
+                       cmpp->minio, mpp->minio);
+               return;
+       }
        if (VECTOR_SIZE(cmpp->pg) != VECTOR_SIZE(mpp->pg)) {
                mpp->action = ACT_RELOAD;
                condlog(3, "set ACT_RELOAD: number of path group change");