Skip to contentSkip to conversation

minio cleanup patches.

PATCH In review Benjamin Marzinski 2 participants 6 messages Jun 15 – Jun 18 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

v2 cover minio cleanup patches.

This patchset is to deprecate the rr_weight, rr_min_io_rq, and rr_min_io multipath config options. It's a companion of the patchset to handle their deprecation in the man pages.
https://lore.kernel.org/all/[email protected]/

It does not completely remove the minio setting code, since there are ideas for reusing this in the future. The final patch is simply a change to avoid a kernel warning message that I hit while testing these patches.

Changes in V2 (due to issues pointed out by Xose Vazquez Perez):
0001: removed rr_weight_mode enum, default value, and print_rr_weight()
function declaration
0002: changed do_default() to mp_set_default()
0003: Removed comment mentioning the DM target version check for
the minio source.

Benjamin Marzinski (4):
libmultipath: deprecate rr_weight, and make it do nothing
libmultipath: deprecate rr_min_io_rq, and make it do nothing
libmultipath: deprecate rr_min_io
libmultipath: don't set hwhander for bio based devices

 libmultipath/config.c    |  6 ---
 libmultipath/config.h    |  6 ---
 libmultipath/configure.c |  1 -
 libmultipath/defaults.h  |  3 +-
 libmultipath/dict.c      | 90 +++++++---------------------------------
 libmultipath/dict.h      |  1 -
 libmultipath/dmparser.c  | 28 +------------
 libmultipath/hwtable.c   |  3 --
 libmultipath/propsel.c   | 54 ++++++------------------
 libmultipath/propsel.h   |  1 -
 libmultipath/structs.h   |  7 ----
 tests/hwtable.c          | 13 ++----
 tests/test-lib.c         |  2 -
 13 files changed, 33 insertions(+), 182 deletions(-)
Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH v2 1/4 libmultipath: deprecate rr_weight, and make it do nothing

Since the kernel has required paths to have a minio of 1 for a long time now, rr_weight is completely useless. Remove all the code for it, and deprecate the option.

---
 libmultipath/config.c    |  3 ---
 libmultipath/config.h    |  3 ---
 libmultipath/configure.c |  1 -
 libmultipath/defaults.h  |  1 -
 libmultipath/dict.c      | 54 ++++------------------------------------
 libmultipath/dict.h      |  1 -
 libmultipath/dmparser.c  | 16 +-----------
 libmultipath/hwtable.c   |  1 -
 libmultipath/propsel.c   | 22 ----------------
 libmultipath/propsel.h   |  1 -
 libmultipath/structs.h   |  7 ------
 11 files changed, 6 insertions(+), 104 deletions(-)
libmultipath/config.c +0 -3
index f9198d60..c0be223a 100644
@@ -447,7 +447,6 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)
 	merge_str(bl_product);
 	merge_num(pgpolicy);
 	merge_num(pgfailback);
-	merge_num(rr_weight);
 	merge_num(no_path_retry);
 	merge_num(minio);
 	merge_num(minio_rq);
@@ -505,7 +504,6 @@ merge_mpe(struct mpentry *dst, struct mpentry *src)
 
 	merge_num(pgpolicy);
 	merge_num(pgfailback);
-	merge_num(rr_weight);
 	merge_num(no_path_retry);
 	merge_num(minio);
 	merge_num(minio_rq);
@@ -616,7 +614,6 @@ store_hwe (vector hwtable, struct hwentry * dhwe)
 
 	hwe->pgpolicy = dhwe->pgpolicy;
 	hwe->pgfailback = dhwe->pgfailback;
-	hwe->rr_weight = dhwe->rr_weight;
 	hwe->no_path_retry = dhwe->no_path_retry;
 	hwe->minio = dhwe->minio;
 	hwe->minio_rq = dhwe->minio_rq;
libmultipath/config.h +0 -3
index 618fa572..3a08b701 100644
@@ -64,7 +64,6 @@ struct hwentry {
 
 	int pgpolicy;
 	int pgfailback;
-	int rr_weight;
 	int no_path_retry;
 	int minio;
 	int minio_rq;
@@ -114,7 +113,6 @@ struct mpentry {
 	uint8_t sa_flags;
 	int pgpolicy;
 	int pgfailback;
-	int rr_weight;
 	int no_path_retry;
 	int minio;
 	int minio_rq;
@@ -151,7 +149,6 @@ struct config {
 	unsigned int max_checkint;
 	unsigned int adjust_int;
 	int pgfailback;
-	int rr_weight;
 	int no_path_retry;
 	int user_friendly_names;
 	int bindings_read_only;
libmultipath/configure.c +0 -1
index a954ca31..9d6aec4d 100644
@@ -336,7 +336,6 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs)
 	else
 		free(save_attr);
 
-	select_rr_weight(conf, mpp);
 	select_minio(conf, mpp);
 	select_mode(conf, mpp);
 	select_uid(conf, mpp);
libmultipath/defaults.h +0 -1
index d80dd7d4..a6e808db 100644
@@ -20,7 +20,6 @@
 #define DEFAULT_MINIO_RQ	1
 #define DEFAULT_PGPOLICY	FAILOVER
 #define DEFAULT_FAILBACK	-FAILBACK_MANUAL
-#define DEFAULT_RR_WEIGHT	RR_WEIGHT_NONE
 #define DEFAULT_NO_PATH_RETRY	NO_PATH_RETRY_UNDEF
 #define DEFAULT_VERBOSITY	2
 #define DEFAULT_REASSIGN_MAPS	0
libmultipath/dict.c +5 -49

90 lines not on this page · raw message

libmultipath/dict.h +0 -1
index 97c91c8e..3757f1ca 100644
@@ -7,7 +7,6 @@ struct strbuf;
 
 void init_keywords(vector keywords);
 int get_sys_max_fds(int *);
-int print_rr_weight(struct strbuf *buff, long v);
 int print_pgfailback(struct strbuf *buff, long v);
 int print_pgpolicy(struct strbuf *buff, long v);
 int print_no_path_retry(struct strbuf *buff, long v);
libmultipath/dmparser.c +1 -15
index 3411bd00..97300668 100644
@@ -89,16 +89,11 @@ int assemble_map(struct multipath *mp, char **params)
 			goto err;
 
 		vector_foreach_slot (pgp->paths, pp, j) {
-			int tmp_minio = minio;
-
-			if (mp->rr_weight == RR_WEIGHT_PRIO
-			    && pp->priority > 0)
-				tmp_minio = minio * pp->priority;
 			if (!strlen(pp->dev_t) ) {
 				condlog(0, "dev_t not set for '%s'", pp->dev);
 				goto err;
 			}
-			if (print_strbuf(&buff, " %s %d", pp->dev_t, tmp_minio) < 0)
+			if (print_strbuf(&buff, " %s %d", pp->dev_t, minio) < 0)
 				goto err;
 		}
 	}
@@ -315,15 +310,6 @@ int disassemble_map(const struct vector_s *pathvec,
 					def_minio = atoi(word);
 					free(word);
 
-					if (!strncmp(mpp->selector,
-						     "round-robin", 11)) {
-
-						if (mpp->rr_weight == RR_WEIGHT_PRIO
-						    && pp->priority > 0)
-							def_minio /= pp->priority;
-
-					}
-
 					if (def_minio != mpp->minio)
 						mpp->minio = def_minio;
 				}
libmultipath/hwtable.c +0 -1
index 23c54933..949ccb33 100644
@@ -56,7 +56,6 @@
 		.prio_name     = PRIO_CONST,
 		.prio_args     = "",
 		.pgfailback    = -FAILBACK_MANUAL,
-		.rr_weight     = RR_WEIGHT_NONE,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
 		.minio         = 1000,
 		.minio_rq      = 1,
libmultipath/propsel.c +0 -22
index 0c10ebc1..bc5aae7d 100644
@@ -211,28 +211,6 @@ out:
 	return 0;
 }
 
-/*
- * selectors :
- * traverse the configuration layers from most specific to most generic
- * stop at first explicit setting found
- */
-int select_rr_weight(struct config *conf, struct multipath * mp)
-{
-	const char *origin;
-	STRBUF_ON_STACK(buff);
-
-	mp_set_mpe(rr_weight);
-	mp_set_ovr(rr_weight);
-	mp_set_hwe(rr_weight);
-	mp_set_conf(rr_weight);
-	mp_set_default(rr_weight, DEFAULT_RR_WEIGHT);
-out:
-	print_rr_weight(&buff, mp->rr_weight);
-	condlog(3, "%s: rr_weight = %s %s", mp->alias,
-		get_strbuf_str(&buff), origin);
-	return 0;
-}
-
 int select_pgfailback(struct config *conf, struct multipath * mp)
 {
 	const char *origin;
libmultipath/propsel.h +0 -1
index bd20e39e..056e841e 100644
@@ -1,6 +1,5 @@
 #ifndef PROPSEL_H_INCLUDED
 #define PROPSEL_H_INCLUDED
-int select_rr_weight (struct config *conf, struct multipath * mp);
 int select_pgfailback (struct config *conf, struct multipath * mp);
 int select_detect_pgpolicy (struct config *conf, struct multipath * mp);
 int select_detect_pgpolicy_use_tpg (struct config *conf, struct multipath * mp);
libmultipath/structs.h +0 -7
index 9adedde2..bf56838c 100644
@@ -43,12 +43,6 @@ enum free_path_mode {
 	FREE_PATHS
 };
 
-enum rr_weight_mode {
-	RR_WEIGHT_UNDEF,
-	RR_WEIGHT_NONE,
-	RR_WEIGHT_PRIO
-};
-
 enum failback_mode {
 	FAILBACK_UNDEF,
 	FAILBACK_MANUAL,
@@ -483,7 +477,6 @@ struct multipath {
 	int uev_wait_tick;
 	int pgfailback;
 	int failback_tick;
-	int rr_weight;
 	int no_path_retry; /* number of retries after all paths are down */
 	int retry_tick;    /* remaining times for retries */
 	int disable_queueing;
Signature · 1 line
2.53.0
author maintainer
#2 lore raw

PATCH v2 2/4 libmultipath: deprecate rr_min_io_rq, and make it do nothing

In reply to Benjamin Marzinski

Since the kernel now requires paths to have a minio of 1, rr_min_io_rq is completely useless. Remove all the code for it, and deprecate the option.

---
 libmultipath/config.c  |  3 ---
 libmultipath/config.h  |  3 ---
 libmultipath/dict.c    | 18 +++++-------------
 libmultipath/hwtable.c |  1 -
 libmultipath/propsel.c | 20 ++++----------------
 tests/hwtable.c        | 13 +++----------
 6 files changed, 12 insertions(+), 46 deletions(-)
libmultipath/config.c +0 -3
index c0be223a..0d877422 100644
@@ -449,7 +449,6 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)
 	merge_num(pgfailback);
 	merge_num(no_path_retry);
 	merge_num(minio);
-	merge_num(minio_rq);
 	merge_num(flush_on_last_del);
 	merge_num(fast_io_fail);
 	merge_num(dev_loss);
@@ -506,7 +505,6 @@ merge_mpe(struct mpentry *dst, struct mpentry *src)
 	merge_num(pgfailback);
 	merge_num(no_path_retry);
 	merge_num(minio);
-	merge_num(minio_rq);
 	merge_num(flush_on_last_del);
 	merge_num(attribute_flags);
 	merge_num(user_friendly_names);
@@ -616,7 +614,6 @@ store_hwe (vector hwtable, struct hwentry * dhwe)
 	hwe->pgfailback = dhwe->pgfailback;
 	hwe->no_path_retry = dhwe->no_path_retry;
 	hwe->minio = dhwe->minio;
-	hwe->minio_rq = dhwe->minio_rq;
 	hwe->flush_on_last_del = dhwe->flush_on_last_del;
 	hwe->fast_io_fail = dhwe->fast_io_fail;
 	hwe->dev_loss = dhwe->dev_loss;
libmultipath/config.h +0 -3
index 3a08b701..ad3b2423 100644
@@ -66,7 +66,6 @@ struct hwentry {
 	int pgfailback;
 	int no_path_retry;
 	int minio;
-	int minio_rq;
 	int flush_on_last_del;
 	int fast_io_fail;
 	unsigned int dev_loss;
@@ -115,7 +114,6 @@ struct mpentry {
 	int pgfailback;
 	int no_path_retry;
 	int minio;
-	int minio_rq;
 	int flush_on_last_del;
 	int attribute_flags;
 	int user_friendly_names;
@@ -144,7 +142,6 @@ struct config {
 	int pgpolicy_flag;
 	int pgpolicy;
 	int minio;
-	int minio_rq;
 	unsigned int checkint;
 	unsigned int max_checkint;
 	unsigned int adjust_int;
libmultipath/dict.c +5 -13
index 502f54b2..3b6584ec 100644
@@ -755,15 +755,6 @@ declare_hw_snprint(minio, print_nonzero)
 declare_mp_range_handler(minio, 0, INT_MAX)
 declare_mp_snprint(minio, print_nonzero)
 
-declare_def_range_handler(minio_rq, 0, INT_MAX)
-declare_def_snprint_defint(minio_rq, print_int, DEFAULT_MINIO_RQ)
-declare_ovr_range_handler(minio_rq, 0, INT_MAX)
-declare_ovr_snprint(minio_rq, print_nonzero)
-declare_hw_range_handler(minio_rq, 0, INT_MAX)
-declare_hw_snprint(minio_rq, print_nonzero)
-declare_mp_range_handler(minio_rq, 0, INT_MAX)
-declare_mp_snprint(minio_rq, print_nonzero)
-
 declare_def_handler(queue_without_daemon, set_yes_no)
 static int
 snprint_def_queue_without_daemon(struct config *conf, struct strbuf *buff,
@@ -2117,6 +2108,7 @@ declare_deprecated_handler(pg_timeout, "(not set)")
 declare_deprecated_handler(bindings_file, DEFAULT_BINDINGS_FILE)
 declare_deprecated_handler(wwids_file, DEFAULT_WWIDS_FILE)
 declare_deprecated_handler(prkeys_file, DEFAULT_PRKEYS_FILE)
+declare_deprecated_handler(minio_rq, "1")
 declare_deprecated_handler(rr_weight, "uniform")
 
 /*
@@ -2144,7 +2136,7 @@ init_keywords(vector keywords)
 	install_keyword("alias_prefix", &def_alias_prefix_handler, &snprint_def_alias_prefix);
 	install_keyword("failback", &def_pgfailback_handler, &snprint_def_pgfailback);
 	install_keyword("rr_min_io", &def_minio_handler, &snprint_def_minio);
-	install_keyword("rr_min_io_rq", &def_minio_rq_handler, &snprint_def_minio_rq);
+	install_keyword("rr_min_io_rq", &deprecated_minio_rq_handler, &snprint_deprecated);
 	install_keyword("max_fds", &max_fds_handler, &snprint_max_fds);
 	install_keyword("rr_weight", &deprecated_rr_weight_handler, &snprint_deprecated);
 	install_keyword("no_path_retry", &def_no_path_retry_handler, &snprint_def_no_path_retry);
@@ -2254,7 +2246,7 @@ init_keywords(vector keywords)
 	install_keyword("rr_weight", &deprecated_rr_weight_handler, &snprint_deprecated);
 	install_keyword("no_path_retry", &hw_no_path_retry_handler, &snprint_hw_no_path_retry);
 	install_keyword("rr_min_io", &hw_minio_handler, &snprint_hw_minio);
-	install_keyword("rr_min_io_rq", &hw_minio_rq_handler, &snprint_hw_minio_rq);
+	install_keyword("rr_min_io_rq", &deprecated_minio_rq_handler, &snprint_deprecated);
 	install_keyword("pg_timeout", &deprecated_pg_timeout_handler, &snprint_deprecated);
 	install_keyword("flush_on_last_del", &hw_flush_on_last_del_handler, &snprint_hw_flush_on_last_del);
 	install_keyword("fast_io_fail_tmo", &hw_fast_io_fail_handler, &snprint_hw_fast_io_fail);
@@ -2300,7 +2292,7 @@ init_keywords(vector keywords)
 	install_keyword("rr_weight", &deprecated_rr_weight_handler, &snprint_deprecated);
 	install_keyword("no_path_retry", &ovr_no_path_retry_handler, &snprint_ovr_no_path_retry);
 	install_keyword("rr_min_io", &ovr_minio_handler, &snprint_ovr_minio);
-	install_keyword("rr_min_io_rq", &ovr_minio_rq_handler, &snprint_ovr_minio_rq);
+	install_keyword("rr_min_io_rq", &deprecated_minio_rq_handler, &snprint_deprecated);
 	install_keyword("flush_on_last_del", &ovr_flush_on_last_del_handler, &snprint_ovr_flush_on_last_del);
 	install_keyword("fast_io_fail_tmo", &ovr_fast_io_fail_handler, &snprint_ovr_fast_io_fail);
 	install_keyword("dev_loss_tmo", &ovr_dev_loss_handler, &snprint_ovr_dev_loss);
@@ -2349,7 +2341,7 @@ init_keywords(vector keywords)
 	install_keyword("rr_weight", &deprecated_rr_weight_handler, &snprint_deprecated);
 	install_keyword("no_path_retry", &mp_no_path_retry_handler, &snprint_mp_no_path_retry);
 	install_keyword("rr_min_io", &mp_minio_handler, &snprint_mp_minio);
-	install_keyword("rr_min_io_rq", &mp_minio_rq_handler, &snprint_mp_minio_rq);
+	install_keyword("rr_min_io_rq", &deprecated_minio_rq_handler, &snprint_deprecated);
 	install_keyword("pg_timeout", &deprecated_pg_timeout_handler, &snprint_deprecated);
 	install_keyword("flush_on_last_del", &mp_flush_on_last_del_handler, &snprint_mp_flush_on_last_del);
 	install_keyword("features", &mp_features_handler, &snprint_mp_features);
libmultipath/hwtable.c +0 -1
index 949ccb33..36646540 100644
@@ -58,7 +58,6 @@
 		.pgfailback    = -FAILBACK_MANUAL,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
 		.minio         = 1000,
-		.minio_rq      = 1,
 		.flush_on_last_del = FLUSH_UNUSED,
 		.user_friendly_names = USER_FRIENDLY_NAMES_OFF,
 		.fast_io_fail  = 5,
libmultipath/propsel.c +4 -16
index bc5aae7d..7f0b66ec 100644
@@ -848,21 +848,6 @@ out:
 	return 0;
 }
 
-int
-select_minio_rq (struct config *conf, struct multipath * mp)
-{
-	const char *origin;
-
-	do_set(minio_rq, mp->mpe, mp->minio, multipaths_origin);
-	do_set(minio_rq, conf->overrides, mp->minio, overrides_origin);
-	do_set_from_hwe(minio_rq, mp, mp->minio, hwe_origin);
-	do_set(minio_rq, conf, mp->minio, conf_origin);
-	do_default(mp->minio, DEFAULT_MINIO_RQ);
-out:
-	condlog(3, "%s: minio = %i %s", mp->alias, mp->minio, origin);
-	return 0;
-}
-
 int
 select_minio_bio (struct config *conf, struct multipath * mp)
 {
@@ -880,13 +865,16 @@ out:
 
 int select_minio(struct config *conf, struct multipath *mp)
 {
+	const char *origin;
 	unsigned int minv_dmrq[3] = {1, 1, 0}, version[3];
 
 	if (!libmp_get_version(DM_MPATH_TARGET_VERSION, version)
 	    && VERSION_GE(version, minv_dmrq))
-		return select_minio_rq(conf, mp);
+		mp_set_default(minio, DEFAULT_MINIO_RQ);
 	else
 		return select_minio_bio(conf, mp);
+	condlog(3, "%s: minio = %i %s", mp->alias, mp->minio, origin);
+	return 0;
 }
 
 int select_fast_io_fail(struct config *conf, struct path *pp)
tests/hwtable.c +3 -10
index 6021bfd3..eb135da1 100644
@@ -406,7 +406,6 @@ static const char _checker[] = "path_checker";
 static const char _vpd_vnd[] = "vpd_vendor";
 static const char _uid_attr[] = "uid_attribute";
 static const char _bl_product[] = "product_blacklist";
-static const char _minio[] = "rr_min_io_rq";
 static const char _no_path_retry[] = "no_path_retry";
 
 /* Device identifiers */
@@ -441,7 +440,6 @@ static const struct key_value bl_bar = { _bl_product, "bar" };
 static const struct key_value bl_baz = { _bl_product, "baz" };
 static const struct key_value bl_barx = { _bl_product, "ba[[rxy]" };
 static const struct key_value bl_bazy = { _bl_product, "ba[zy]" };
-static const struct key_value minio_99 = { _minio, "99" };
 static const struct key_value npr_37 = { _no_path_retry, "37" };
 static const struct key_value npr_queue = { _no_path_retry, "queue" };
 
@@ -552,7 +550,6 @@ static void test_sanity_globals(void **state)
 	assert_string_not_equal(chk_hp.value, DEFAULT_CHECKER);
 	assert_int_not_equal(MULTIBUS, DEFAULT_PGPOLICY);
 	assert_int_not_equal(NO_PATH_RETRY_QUEUE, DEFAULT_NO_PATH_RETRY);
-	assert_int_not_equal(atoi(minio_99.value), DEFAULT_MINIO_RQ);
 	assert_int_not_equal(atoi(npr_37.value), DEFAULT_NO_PATH_RETRY);
 }
 
@@ -1566,7 +1563,6 @@ static void test_multipath_config(const struct hwt_state *hwt)
 	mp = mock_multipath(pp);
 	assert_ptr_not_equal(mp->mpe, NULL);
 	TEST_PROP(prio_name(&pp->prio), prio_rdac.value);
-	assert_int_equal(mp->minio, atoi(minio_99.value));
 	TEST_PROP(pp->uid_attribute, uid_baz.value);
 
 	/* test different wwid */
@@ -1574,14 +1570,13 @@ static void test_multipath_config(const struct hwt_state *hwt)
 	mp = mock_multipath(pp);
 	// assert_ptr_equal(mp->mpe, NULL);
 	TEST_PROP(prio_name(&pp->prio), prio_emc.value);
-	assert_int_equal(mp->minio, DEFAULT_MINIO_RQ);
 	TEST_PROP(pp->uid_attribute, uid_baz.value);
 }
 
 static int setup_multipath_config(void **state)
 {
 	struct hwt_state *hwt = CHECK_STATE(state);
-	const struct key_value kvm[] = { wwid_test, prio_rdac, minio_99 };
+	const struct key_value kvm[] = { wwid_test, prio_rdac };
 	const struct key_value kvp[] = { vnd_foo, prd_bar, prio_emc, uid_baz };
 
 	begin_config(hwt);
@@ -1612,14 +1607,13 @@ static void test_multipath_config_2(const struct hwt_state *hwt)
 	assert_ptr_not_equal(mp, NULL);
 	assert_ptr_not_equal(mp->mpe, NULL);
 	TEST_PROP(prio_name(&pp->prio), prio_rdac.value);
-	assert_int_equal(mp->minio, atoi(minio_99.value));
 	assert_int_equal(mp->no_path_retry, atoi(npr_37.value));
 }
 
 static int setup_multipath_config_2(void **state)
 {
 	const struct key_value kv1[] = { wwid_test, prio_rdac, npr_queue };
-	const struct key_value kv2[] = { wwid_test, minio_99, npr_37 };
+	const struct key_value kv2[] = { wwid_test, npr_37 };
 	struct hwt_state *hwt = CHECK_STATE(state);
 
 	begin_config(hwt);
@@ -1647,14 +1641,13 @@ static void test_multipath_config_3(const struct hwt_state *hwt)
 	assert_ptr_not_equal(mp, NULL);
 	assert_ptr_not_equal(mp->mpe, NULL);
 	TEST_PROP(prio_name(&pp->prio), prio_rdac.value);
-	assert_int_equal(mp->minio, atoi(minio_99.value));
 	assert_int_equal(mp->no_path_retry, atoi(npr_37.value));
 }
 
 static int setup_multipath_config_3(void **state)
 {
 	const struct key_value kv1[] = { wwid_test, prio_rdac, npr_queue };
-	const struct key_value kv2[] = { wwid_test, minio_99, npr_37 };
+	const struct key_value kv2[] = { wwid_test, npr_37 };
 	struct hwt_state *hwt = CHECK_STATE(state);
 
 	begin_config(hwt);
Signature · 1 line
2.53.0
author maintainer
#3 lore raw

PATCH v2 3/4 libmultipath: deprecate rr_min_io

In reply to Benjamin Marzinski

Since the kernel now requires paths to have a minio of 1, rr_min_io is currently useless. However, bio-based multipath performs significantly worse than request-based multipath. Part of that is because bio-based multipath will call the path selector to pick a new path for every bio, making it very unlikely that adjacent bios will be merged. So this patch leaves the bio-based minio code around, since we may revisit this in the future. It does disable setting the value in multipath.conf, and changes the default to 1. Also, it fixes select_minio() to actually check if the multipath device is bio-based or request-based, and it takes out the code for modifying the minio based on the status of the "least-pending" path selector, because that no longer exists.

---
 libmultipath/defaults.h |  2 +-
 libmultipath/dict.c     | 18 +++++-------------
 libmultipath/dmparser.c | 12 +-----------
 libmultipath/hwtable.c  |  1 -
 libmultipath/propsel.c  |  8 +++-----
 tests/test-lib.c        |  2 --
 6 files changed, 10 insertions(+), 33 deletions(-)
libmultipath/defaults.h +1 -1
index a6e808db..ea1fce0e 100644
@@ -16,7 +16,7 @@
 #define DEFAULT_ALIAS_PREFIX	"mpath"
 #define DEFAULT_FEATURES	"0"
 #define DEFAULT_HWHANDLER	"0"
-#define DEFAULT_MINIO		1000
+#define DEFAULT_MINIO		1
 #define DEFAULT_MINIO_RQ	1
 #define DEFAULT_PGPOLICY	FAILOVER
 #define DEFAULT_FAILBACK	-FAILBACK_MANUAL
libmultipath/dict.c +5 -13
index 3b6584ec..0e947b1d 100644
@@ -746,15 +746,6 @@ declare_ovr_snprint(checker_name, print_str)
 declare_hw_handler(checker_name, set_str)
 declare_hw_snprint(checker_name, print_str)
 
-declare_def_range_handler(minio, 0, INT_MAX)
-declare_def_snprint_defint(minio, print_int, DEFAULT_MINIO)
-declare_ovr_range_handler(minio, 0, INT_MAX)
-declare_ovr_snprint(minio, print_nonzero)
-declare_hw_range_handler(minio, 0, INT_MAX)
-declare_hw_snprint(minio, print_nonzero)
-declare_mp_range_handler(minio, 0, INT_MAX)
-declare_mp_snprint(minio, print_nonzero)
-
 declare_def_handler(queue_without_daemon, set_yes_no)
 static int
 snprint_def_queue_without_daemon(struct config *conf, struct strbuf *buff,
@@ -2108,6 +2099,7 @@ declare_deprecated_handler(pg_timeout, "(not set)")
 declare_deprecated_handler(bindings_file, DEFAULT_BINDINGS_FILE)
 declare_deprecated_handler(wwids_file, DEFAULT_WWIDS_FILE)
 declare_deprecated_handler(prkeys_file, DEFAULT_PRKEYS_FILE)
+declare_deprecated_handler(minio, "1")
 declare_deprecated_handler(minio_rq, "1")
 declare_deprecated_handler(rr_weight, "uniform")
 
@@ -2135,7 +2127,7 @@ init_keywords(vector keywords)
 	install_keyword("checker", &def_checker_name_handler, NULL);
 	install_keyword("alias_prefix", &def_alias_prefix_handler, &snprint_def_alias_prefix);
 	install_keyword("failback", &def_pgfailback_handler, &snprint_def_pgfailback);
-	install_keyword("rr_min_io", &def_minio_handler, &snprint_def_minio);
+	install_keyword("rr_min_io", &deprecated_minio_handler, &snprint_deprecated);
 	install_keyword("rr_min_io_rq", &deprecated_minio_rq_handler, &snprint_deprecated);
 	install_keyword("max_fds", &max_fds_handler, &snprint_max_fds);
 	install_keyword("rr_weight", &deprecated_rr_weight_handler, &snprint_deprecated);
@@ -2245,7 +2237,7 @@ init_keywords(vector keywords)
 	install_keyword("failback", &hw_pgfailback_handler, &snprint_hw_pgfailback);
 	install_keyword("rr_weight", &deprecated_rr_weight_handler, &snprint_deprecated);
 	install_keyword("no_path_retry", &hw_no_path_retry_handler, &snprint_hw_no_path_retry);
-	install_keyword("rr_min_io", &hw_minio_handler, &snprint_hw_minio);
+	install_keyword("rr_min_io", &deprecated_minio_handler, &snprint_deprecated);
 	install_keyword("rr_min_io_rq", &deprecated_minio_rq_handler, &snprint_deprecated);
 	install_keyword("pg_timeout", &deprecated_pg_timeout_handler, &snprint_deprecated);
 	install_keyword("flush_on_last_del", &hw_flush_on_last_del_handler, &snprint_hw_flush_on_last_del);
@@ -2291,7 +2283,7 @@ init_keywords(vector keywords)
 	install_keyword("failback", &ovr_pgfailback_handler, &snprint_ovr_pgfailback);
 	install_keyword("rr_weight", &deprecated_rr_weight_handler, &snprint_deprecated);
 	install_keyword("no_path_retry", &ovr_no_path_retry_handler, &snprint_ovr_no_path_retry);
-	install_keyword("rr_min_io", &ovr_minio_handler, &snprint_ovr_minio);
+	install_keyword("rr_min_io", &deprecated_minio_handler, &snprint_deprecated);
 	install_keyword("rr_min_io_rq", &deprecated_minio_rq_handler, &snprint_deprecated);
 	install_keyword("flush_on_last_del", &ovr_flush_on_last_del_handler, &snprint_ovr_flush_on_last_del);
 	install_keyword("fast_io_fail_tmo", &ovr_fast_io_fail_handler, &snprint_ovr_fast_io_fail);
@@ -2340,7 +2332,7 @@ init_keywords(vector keywords)
 	install_keyword("failback", &mp_pgfailback_handler, &snprint_mp_pgfailback);
 	install_keyword("rr_weight", &deprecated_rr_weight_handler, &snprint_deprecated);
 	install_keyword("no_path_retry", &mp_no_path_retry_handler, &snprint_mp_no_path_retry);
-	install_keyword("rr_min_io", &mp_minio_handler, &snprint_mp_minio);
+	install_keyword("rr_min_io", &deprecated_minio_handler, &snprint_deprecated);
 	install_keyword("rr_min_io_rq", &deprecated_minio_rq_handler, &snprint_deprecated);
 	install_keyword("pg_timeout", &deprecated_pg_timeout_handler, &snprint_deprecated);
 	install_keyword("flush_on_last_del", &mp_flush_on_last_del_handler, &snprint_mp_flush_on_last_del);
libmultipath/dmparser.c +1 -11
index 97300668..83760e30 100644
@@ -337,7 +337,6 @@ int disassemble_status(const char *params, struct multipath *mpp)
 	int num_pg;
 	int num_pg_args;
 	int num_paths;
-	int def_minio = 0;
 	struct path * pp;
 	struct pathgroup * pgp;
 
@@ -507,16 +506,7 @@ int disassemble_status(const char *params, struct multipath *mpp)
 			 * selector args
 			 */
 			for (k = 0; k < num_pg_args; k++) {
-				if (!strncmp(mpp->selector,
-					     "least-pending", 13)) {
-					p += get_word(p, &word);
-					if (sscanf(word,"%d:*d",
-						   &def_minio) == 1 &&
-					    def_minio != mpp->minio)
-							mpp->minio = def_minio;
-					free(word);
-				} else
-					p += get_word(p, NULL);
+				p += get_word(p, NULL);
 			}
 		}
 	}
libmultipath/hwtable.c +0 -1
index 36646540..a8fbfa70 100644
@@ -57,7 +57,6 @@
 		.prio_args     = "",
 		.pgfailback    = -FAILBACK_MANUAL,
 		.no_path_retry = NO_PATH_RETRY_UNDEF,
-		.minio         = 1000,
 		.flush_on_last_del = FLUSH_UNUSED,
 		.user_friendly_names = USER_FRIENDLY_NAMES_OFF,
 		.fast_io_fail  = 5,
libmultipath/propsel.c +3 -5
index 7f0b66ec..277214f6 100644
@@ -866,13 +866,11 @@ out:
 int select_minio(struct config *conf, struct multipath *mp)
 {
 	const char *origin;
-	unsigned int minv_dmrq[3] = {1, 1, 0}, version[3];
 
-	if (!libmp_get_version(DM_MPATH_TARGET_VERSION, version)
-	    && VERSION_GE(version, minv_dmrq))
-		mp_set_default(minio, DEFAULT_MINIO_RQ);
-	else
+	if (mp->queue_mode == QUEUE_MODE_BIO)
 		return select_minio_bio(conf, mp);
+
+	mp_set_default(minio, DEFAULT_MINIO_RQ);
 	condlog(3, "%s: minio = %i %s", mp->alias, mp->minio, origin);
 	return 0;
 }
tests/test-lib.c +0 -2
index ea99977f..9a229e47 100644
@@ -398,7 +398,6 @@ struct multipath *mock_multipath__(struct vectors *vecs, struct path *pp)
 	struct multipath *mp;
 	struct config *conf;
 	struct mocked_path mop;
-	/* pretend new dm, use minio_rq,  */
 	static const unsigned int fake_dm_tgt_version[3] = { 1, 1, 1 };
 
 	mocked_path_from_path(&mop, pp);
@@ -414,7 +413,6 @@ struct multipath *mock_multipath__(struct vectors *vecs, struct path *pp)
 	select_no_path_retry(conf, mp);
 	will_return(__wrap_libmp_get_version, fake_dm_tgt_version);
 	select_retain_hwhandler(conf, mp);
-	will_return(__wrap_libmp_get_version, fake_dm_tgt_version);
 	select_minio(conf, mp);
 	put_multipath_config(conf);
 
Signature · 1 line
2.53.0
author maintainer
#4 lore raw

PATCH v2 4/4 libmultipath: don't set hwhander for bio based devices

In reply to Benjamin Marzinski

The kernel prints an error message when a bio-based multipath device sets a hardware handler, since bio-based devices only support using the already attached hardware handler as-is. Change select_hwhandler() to not set a hardware handler for bio-based devices.

---
 libmultipath/propsel.c | 6 ++++++
 1 file changed, 6 insertions(+)
libmultipath/propsel.c +6 -0
index 277214f6..0202aaef 100644
@@ -560,6 +560,11 @@ int select_hwhandler(struct config *conf, struct multipath *mp)
 
 	dh_state = &handler[2];
 
+	if (mp->queue_mode == QUEUE_MODE_BIO) {
+		mp->hwhandler = DEFAULT_HWHANDLER;
+		origin = "(setting: disabled due to \"queue_mode bio\")";
+		goto set;
+	}
 	/*
 	 * TPGS_UNDEF means that ALUA support couldn't determined either way
 	 * yet, probably because the path was always down.
@@ -600,6 +605,7 @@ out:
 		mp->hwhandler = DEFAULT_HWHANDLER;
 		origin = tpgs_origin;
 	}
+set:
 	mp->hwhandler = strdup(mp->hwhandler);
 	condlog(3, "%s: hardware_handler = \"%s\" %s", mp->alias, mp->hwhandler,
 		origin);
Signature · 1 line
2.53.0
Reviewed-by on the v2 series
#5 lore raw
In reply to Benjamin Marzinski
Quoted 11 lines · Benjamin Marzinski

This patchset is to deprecate the rr_weight, rr_min_io_rq, and rr_min_io
multipath config options. It's a companion of the patchset to handle their deprecation in the man pages.
https://lore.kernel.org/all/[email protected]/

It does not completely remove the minio setting code, since there are ideas for reusing this in the future. The final patch is simply a change
to avoid a kernel warning message that I hit while testing these patches.

With patch 1/4 goes our only way to set path-specific weights. But it wasn't functional anyway, so if we want to do anything of the kind again in the future, we'll have to re-implement it in a cleaner way than what we had until now.

For the series:

Quoted 30 lines

Changes in V2 (due to issues pointed out by Xose Vazquez Perez):
0001: removed rr_weight_mode enum, default value, and print_rr_weight()
      function declaration
0002: changed do_default() to mp_set_default()
0003: Removed comment mentioning the DM target version check for the minio source.

Benjamin Marzinski (4):
  libmultipath: deprecate rr_weight, and make it do nothing
  libmultipath: deprecate rr_min_io_rq, and make it do nothing
  libmultipath: deprecate rr_min_io
  libmultipath: don't set hwhander for bio based devices

 libmultipath/config.c    |  6 ---
 libmultipath/config.h    |  6 --- libmultipath/configure.c |  1 -
 libmultipath/defaults.h  |  3 +-
 libmultipath/dict.c      | 90 +++++++------------------------------- --
 libmultipath/dict.h      |  1 -
 libmultipath/dmparser.c  | 28 +------------

 libmultipath/hwtable.c   |  3 --
 libmultipath/propsel.c   | 54 ++++++------------------
 libmultipath/propsel.h   |  1 -
 libmultipath/structs.h   |  7 ----
 tests/hwtable.c          | 13 ++----
 tests/test-lib.c         |  2 -
 13 files changed, 33 insertions(+), 182 deletions(-)