Linux Device Mapper development
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: dm-devel@redhat.com
Subject: [PATCH 10/42] Introduce MP_FAST_IO_FAIL_UNSET
Date: Tue,  8 Jan 2013 14:53:48 +0100	[thread overview]
Message-ID: <1357653259-62650-11-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1357653259-62650-1-git-send-email-hare@suse.de>

For completeness; all other special values are encoded with
defines, so 'unset' should be, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/config.h    |    1 +
 libmultipath/dict.c      |    8 ++++----
 libmultipath/discovery.c |    6 +++---
 libmultipath/propsel.c   |    6 +++---
 libmultipath/structs.c   |    1 +
 5 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/libmultipath/config.h b/libmultipath/config.h
index 16f530f..51fc492 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -11,6 +11,7 @@
  * In kernel, fast_io_fail == 0 means immediate failure on rport delete.
  * OTOH '0' means not-configured in various places in multipath-tools.
  */
+#define MP_FAST_IO_FAIL_UNSET (0)
 #define MP_FAST_IO_FAIL_OFF (-1)
 #define MP_FAST_IO_FAIL_ZERO (-2)
 
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index fe1362e..ab9fdeb 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -47,7 +47,7 @@ def_fast_io_fail_handler(vector strvec)
 		conf->fast_io_fail = MP_FAST_IO_FAIL_OFF;
 	else if (sscanf(buff, "%d", &conf->fast_io_fail) != 1 ||
 		 conf->fast_io_fail < MP_FAST_IO_FAIL_ZERO)
-		conf->fast_io_fail = 0;
+		conf->fast_io_fail = MP_FAST_IO_FAIL_UNSET;
 	else if (conf->fast_io_fail == 0)
 		conf->fast_io_fail = MP_FAST_IO_FAIL_ZERO;
 
@@ -882,7 +882,7 @@ hw_fast_io_fail_handler(vector strvec)
 		hwe->fast_io_fail = MP_FAST_IO_FAIL_OFF;
 	else if (sscanf(buff, "%d", &hwe->fast_io_fail) != 1 ||
 		 hwe->fast_io_fail < MP_FAST_IO_FAIL_ZERO)
-		hwe->fast_io_fail = 0;
+		hwe->fast_io_fail = MP_FAST_IO_FAIL_UNSET;
 	else if (hwe->fast_io_fail == 0)
 		hwe->fast_io_fail = MP_FAST_IO_FAIL_ZERO;
 
@@ -1973,7 +1973,7 @@ static int
 snprint_hw_fast_io_fail(char * buff, int len, void * data)
 {
 	struct hwentry * hwe = (struct hwentry *)data;
-	if (!hwe->fast_io_fail)
+	if (hwe->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
 		return 0;
 	if (hwe->fast_io_fail == conf->fast_io_fail)
 		return 0;
@@ -2282,7 +2282,7 @@ snprint_def_polling_interval (char * buff, int len, void * data)
 static int
 snprint_def_fast_io_fail(char * buff, int len, void * data)
 {
-	if (!conf->fast_io_fail)
+	if (conf->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
 		return 0;
 	if (conf->fast_io_fail == MP_FAST_IO_FAIL_OFF)
 		return snprintf(buff, len, "off");
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 6f5470f..e328332 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -283,7 +283,7 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
 	snprintf(value, 11, "%u", mpp->dev_loss);
 	if (mpp->dev_loss &&
 	    sysfs_attr_set_value(rport_dev, "dev_loss_tmo", value, 11) <= 0) {
-		if ((!mpp->fast_io_fail ||
+		if ((mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET ||
 		     mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
 		    && mpp->dev_loss > 600) {
 			condlog(3, "%s: limiting dev_loss_tmo to 600, since "
@@ -296,7 +296,7 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
 			goto out;
 		}
 	}
-	if (mpp->fast_io_fail){
+	if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET){
 		if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
 			sprintf(value, "off");
 		else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
@@ -340,7 +340,7 @@ sysfs_set_scsi_tmo (struct multipath *mpp)
 			mpp->alias, mpp->fast_io_fail);
 		mpp->fast_io_fail = MP_FAST_IO_FAIL_OFF;
 	}
-	if (!mpp->dev_loss && !mpp->fast_io_fail)
+	if (!mpp->dev_loss && mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
 		return 0;
 
 	vector_foreach_slot(mpp->paths, pp, i) {
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 17bd893..756aced 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -558,7 +558,7 @@ select_pg_timeout(struct multipath *mp)
 extern int
 select_fast_io_fail(struct multipath *mp)
 {
-	if (mp->hwe && mp->hwe->fast_io_fail) {
+	if (mp->hwe && mp->hwe->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
 		mp->fast_io_fail = mp->hwe->fast_io_fail;
 		if (mp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
 			condlog(3, "%s: fast_io_fail_tmo = off (controller default)", mp->alias);
@@ -567,7 +567,7 @@ select_fast_io_fail(struct multipath *mp)
 				mp->fast_io_fail == MP_FAST_IO_FAIL_ZERO ? 0 : mp->fast_io_fail);
 		return 0;
 	}
-	if (conf->fast_io_fail) {
+	if (conf->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
 		mp->fast_io_fail = conf->fast_io_fail;
 		if (mp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
 			condlog(3, "%s: fast_io_fail_tmo = off (config file default)", mp->alias);
@@ -576,7 +576,7 @@ select_fast_io_fail(struct multipath *mp)
 				mp->fast_io_fail == MP_FAST_IO_FAIL_ZERO ? 0 : mp->fast_io_fail);
 		return 0;
 	}
-	mp->fast_io_fail = 0;
+	mp->fast_io_fail = MP_FAST_IO_FAIL_UNSET;
 	return 0;
 }
 
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index ab57559..88e8706 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -131,6 +131,7 @@ alloc_multipath (void)
 		mpp->bestpg = 1;
 		mpp->mpcontext = NULL;
 		mpp->no_path_retry = NO_PATH_RETRY_UNDEF;
+		mpp->fast_io_fail = MP_FAST_IO_FAIL_UNSET;
 	}
 	return mpp;
 }
-- 
1.7.4.2

  parent reply	other threads:[~2013-01-08 13:53 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08 13:53 [PATCH 00/42] SLES resync Hannes Reinecke
2013-01-08 13:53 ` [PATCH 01/42] libmultipath: Invalid check for mpp->wwid in dm_addmap() Hannes Reinecke
2013-01-08 13:53 ` [PATCH 02/42] Remove newline from condlog() Hannes Reinecke
2013-01-08 13:53 ` [PATCH 03/42] Fixup pathgroup allocation in disassemble_map() Hannes Reinecke
2013-01-08 13:53 ` [PATCH 04/42] libmultipath: resource leak in read_value_block() Hannes Reinecke
2013-01-08 13:53 ` [PATCH 05/42] prio: fix merging of prioritizers with different args Hannes Reinecke
2013-01-08 13:53 ` [PATCH 06/42] Accept several whitespaces in bindings file Hannes Reinecke
2013-01-08 13:53 ` [PATCH 07/42] Add TAGS makefile target Hannes Reinecke
2013-01-08 13:53 ` [PATCH 08/42] libmultipath: Fix typo in mp_prio_handler() Hannes Reinecke
2013-01-08 13:53 ` [PATCH 09/42] Do not trigger a map reload on priority updates Hannes Reinecke
2013-01-08 13:53 ` Hannes Reinecke [this message]
2013-01-08 13:53 ` [PATCH 11/42] Checker name is not displayed on failure Hannes Reinecke
2013-01-08 13:53 ` [PATCH 12/42] Valgrind fixes for prioritizer Hannes Reinecke
2013-01-08 13:53 ` [PATCH 13/42] Incorrect inquiry vendor length in hds prioritizer Hannes Reinecke
2013-01-08 13:53 ` [PATCH 14/42] Print out multipath alias for flush_on_last_del messages Hannes Reinecke
2013-01-08 13:53 ` [PATCH 15/42] Clarify setting origin in propsel.c Hannes Reinecke
2013-01-08 13:53 ` [PATCH 16/42] libmultipath: error checking in remove_features() Hannes Reinecke
2013-01-08 13:53 ` [PATCH 17/42] Increase parameter buffer Hannes Reinecke
2013-01-08 13:53 ` [PATCH 18/42] Check return code from pathinfo() Hannes Reinecke
2013-01-08 13:53 ` [PATCH 19/42] Inconsistent string quoting Hannes Reinecke
2013-01-08 13:53 ` [PATCH 20/42] Switch off 'queue_if_no_path' before removing maps Hannes Reinecke
2013-01-08 13:53 ` [PATCH 21/42] Double free in disassemble_map() Hannes Reinecke
2013-01-08 13:54 ` [PATCH 22/42] libmultipath: prio keyword ignored for multipath config Hannes Reinecke
2013-01-08 13:54 ` [PATCH 23/42] Path checker should return PATH_DOWN when no path is found Hannes Reinecke
2013-01-08 13:54 ` [PATCH 24/42] Do not call sysfs_get_timeout for non-SCSI devices Hannes Reinecke
2013-01-08 13:54 ` [PATCH 25/42] Make log_pthread more robust Hannes Reinecke
2013-01-09  0:16   ` Christophe Varoqui
2013-01-09 19:15     ` Xose Vazquez Perez
2013-01-08 13:54 ` [PATCH 26/42] Print log messages when updating tables failed Hannes Reinecke
2013-01-08 13:54 ` [PATCH 27/42] Update 'no_path_retry' correctly for failed paths Hannes Reinecke
2013-01-08 13:54 ` [PATCH 28/42] Clean up uevent queue on shutdown Hannes Reinecke
2013-01-08 13:54 ` [PATCH 29/42] libmultipath: Print out uevent sequence number Hannes Reinecke
2013-01-08 13:54 ` [PATCH 30/42] Fix race condition in stop_waiter_thread() Hannes Reinecke
2013-01-08 13:54 ` [PATCH 31/42] Use VECTOR_SIZE() defines Hannes Reinecke
2013-01-08 13:54 ` [PATCH 32/42] Make 'allocated' an integer in vector.h Hannes Reinecke
2013-01-08 13:54 ` [PATCH 33/42] Syntax error in /etc/init.d/boot.multipath Hannes Reinecke
2013-01-08 13:54 ` [PATCH 34/42] multipath.init.suse: Update usage message Hannes Reinecke
2013-01-08 13:54 ` [PATCH 35/42] multipath.conf.5: Clarify dev_loss_tmo settings Hannes Reinecke
2013-01-08 13:54 ` [PATCH 36/42] Clarify dev_loss_tmo capping in multipath.conf.5 Hannes Reinecke
2013-01-08 13:54 ` [PATCH 38/42] multipathd: Ignore errors when creating pidfile Hannes Reinecke
2013-01-08 13:54 ` [PATCH 39/42] multipathd deadlocks during restart Hannes Reinecke
2013-01-08 13:54 ` [PATCH 40/42] multipathd: sighandlers might use uninitialized gvecs Hannes Reinecke
2013-01-08 13:54 ` [PATCH 41/42] multipathd: crash in reconfigure CLI command Hannes Reinecke
2013-01-08 13:54 ` [PATCH 42/42] multipathd: lock vectors during initial configuration Hannes Reinecke
2013-01-08 23:37   ` Christophe Varoqui
2013-01-09  7:01     ` Hannes Reinecke
2013-01-08 23:53 ` [PATCH 00/42] SLES resync Christophe Varoqui
2013-01-10  5:36   ` Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357653259-62650-11-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=christophe.varoqui@gmail.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox