diff mbox series

[v2,09/22] multipathd: split do_checker_path

Message ID 20240912214947.783819-10-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: Benjamin Marzinski
Headers show
Series Yet Another path checker refactor | expand

Commit Message

Benjamin Marzinski Sept. 12, 2024, 9:49 p.m. UTC
Move the code that starts the path checker from do_check_path() into
check_path(), rename the remainder of do_check_path() to
update_path_state() and call that from check_path().

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 multipathd/main.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

Martin Wilck Oct. 3, 2024, 8:23 p.m. UTC | #1
Nit: the subject should refer to "do_check_path".
Also, the word "split" is somewhat confusing as you've been using it 
for actually splitting one function into two elsewhere in this set.

Perhaps just call the patch "rename do_check_path to
update_path_state".

On Thu, 2024-09-12 at 17:49 -0400, Benjamin Marzinski wrote:
> Move the code that starts the path checker from do_check_path() into
> check_path(), rename the remainder of do_check_path() to
> update_path_state() and call that from check_path().
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  multipathd/main.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/multipathd/main.c b/multipathd/main.c
> index 16c0531e..9319751e 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -2396,7 +2396,7 @@ enum check_path_return {
>  };
>  
>  static int
> -do_check_path (struct vectors * vecs, struct path * pp)
> +update_path_state (struct vectors * vecs, struct path * pp)
>  {
>  	int newstate;
>  	int new_path_up = 0;
> @@ -2414,12 +2414,6 @@ do_check_path (struct vectors * vecs, struct
> path * pp)
>  	marginal_pathgroups = conf->marginal_pathgroups;
>  	put_multipath_config(conf);
>  
> -	if (pp->checkint == CHECKINT_UNDEF) {
> -		condlog(0, "%s: BUG: checkint is not set", pp->dev);
> -		pp->checkint = checkint;
> -	};
> -
> -	start_path_check(pp);
>  	newstate = get_new_state(pp);
>  	if (newstate == PATH_WILD || newstate == PATH_UNCHECKED)
>  		return CHECK_PATH_SKIPPED;
> @@ -2639,7 +2633,7 @@ check_path (struct vectors * vecs, struct path
> * pp, unsigned int ticks,
>  	    time_t start_secs)
>  {
>  	int r;
> -	unsigned int adjust_int, max_checkint;
> +	unsigned int adjust_int, checkint, max_checkint;
>  	struct config *conf;
>  	time_t next_idx, goal_idx;
>  
> @@ -2652,14 +2646,21 @@ check_path (struct vectors * vecs, struct
> path * pp, unsigned int ticks,
>  		return CHECK_PATH_SKIPPED;
>  
>  	conf = get_multipath_config();
> +	checkint = conf->checkint;
>  	max_checkint = conf->max_checkint;
>  	adjust_int = conf->adjust_int;
>  	put_multipath_config(conf);
>  
> -	r = do_check_path(vecs, pp);
> +	if (pp->checkint == CHECKINT_UNDEF) {
> +		condlog(0, "%s: BUG: checkint is not set", pp->dev);
> +		pp->checkint = checkint;
> +	}
> +
> +	start_path_check(pp);
> +	r = update_path_state(vecs, pp);
>  
>  	/*
> -	 * do_check_path() removed or orphaned the path.
> +	 * update_path() removed or orphaned the path.

Nit: update_path() is introduced in the follow-up patch.
Should this be update_path_state()?

Martin


>  	 */
>  	if (r == CHECK_PATH_REMOVED || !pp->mpp)
>  		return r;
Benjamin Marzinski Oct. 8, 2024, 6:18 p.m. UTC | #2
On Thu, Oct 03, 2024 at 10:23:51PM +0200, Martin Wilck wrote:
> Nit: the subject should refer to "do_check_path".
> Also, the word "split" is somewhat confusing as you've been using it 
> for actually splitting one function into two elsewhere in this set.
> 
> Perhaps just call the patch "rename do_check_path to
> update_path_state".

Sure.

> 
> On Thu, 2024-09-12 at 17:49 -0400, Benjamin Marzinski wrote:
> > Move the code that starts the path checker from do_check_path() into
> > check_path(), rename the remainder of do_check_path() to
> > update_path_state() and call that from check_path().
> > 
> > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> > ---
> >  multipathd/main.c | 21 +++++++++++----------
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> > 
> > diff --git a/multipathd/main.c b/multipathd/main.c
> > index 16c0531e..9319751e 100644
> > --- a/multipathd/main.c
> > +++ b/multipathd/main.c
> > @@ -2396,7 +2396,7 @@ enum check_path_return {
> >  };
> >  
> >  static int
> > -do_check_path (struct vectors * vecs, struct path * pp)
> > +update_path_state (struct vectors * vecs, struct path * pp)
> >  {
> >  	int newstate;
> >  	int new_path_up = 0;
> > @@ -2414,12 +2414,6 @@ do_check_path (struct vectors * vecs, struct
> > path * pp)
> >  	marginal_pathgroups = conf->marginal_pathgroups;
> >  	put_multipath_config(conf);
> >  
> > -	if (pp->checkint == CHECKINT_UNDEF) {
> > -		condlog(0, "%s: BUG: checkint is not set", pp->dev);
> > -		pp->checkint = checkint;
> > -	};
> > -
> > -	start_path_check(pp);
> >  	newstate = get_new_state(pp);
> >  	if (newstate == PATH_WILD || newstate == PATH_UNCHECKED)
> >  		return CHECK_PATH_SKIPPED;
> > @@ -2639,7 +2633,7 @@ check_path (struct vectors * vecs, struct path
> > * pp, unsigned int ticks,
> >  	    time_t start_secs)
> >  {
> >  	int r;
> > -	unsigned int adjust_int, max_checkint;
> > +	unsigned int adjust_int, checkint, max_checkint;
> >  	struct config *conf;
> >  	time_t next_idx, goal_idx;
> >  
> > @@ -2652,14 +2646,21 @@ check_path (struct vectors * vecs, struct
> > path * pp, unsigned int ticks,
> >  		return CHECK_PATH_SKIPPED;
> >  
> >  	conf = get_multipath_config();
> > +	checkint = conf->checkint;
> >  	max_checkint = conf->max_checkint;
> >  	adjust_int = conf->adjust_int;
> >  	put_multipath_config(conf);
> >  
> > -	r = do_check_path(vecs, pp);
> > +	if (pp->checkint == CHECKINT_UNDEF) {
> > +		condlog(0, "%s: BUG: checkint is not set", pp->dev);
> > +		pp->checkint = checkint;
> > +	}
> > +
> > +	start_path_check(pp);
> > +	r = update_path_state(vecs, pp);
> >  
> >  	/*
> > -	 * do_check_path() removed or orphaned the path.
> > +	 * update_path() removed or orphaned the path.
> 
> Nit: update_path() is introduced in the follow-up patch.
> Should this be update_path_state()?

Oops. Yep.

-Ben

> 
> Martin
> 
> 
> >  	 */
> >  	if (r == CHECK_PATH_REMOVED || !pp->mpp)
> >  		return r;
diff mbox series

Patch

diff --git a/multipathd/main.c b/multipathd/main.c
index 16c0531e..9319751e 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2396,7 +2396,7 @@  enum check_path_return {
 };
 
 static int
-do_check_path (struct vectors * vecs, struct path * pp)
+update_path_state (struct vectors * vecs, struct path * pp)
 {
 	int newstate;
 	int new_path_up = 0;
@@ -2414,12 +2414,6 @@  do_check_path (struct vectors * vecs, struct path * pp)
 	marginal_pathgroups = conf->marginal_pathgroups;
 	put_multipath_config(conf);
 
-	if (pp->checkint == CHECKINT_UNDEF) {
-		condlog(0, "%s: BUG: checkint is not set", pp->dev);
-		pp->checkint = checkint;
-	};
-
-	start_path_check(pp);
 	newstate = get_new_state(pp);
 	if (newstate == PATH_WILD || newstate == PATH_UNCHECKED)
 		return CHECK_PATH_SKIPPED;
@@ -2639,7 +2633,7 @@  check_path (struct vectors * vecs, struct path * pp, unsigned int ticks,
 	    time_t start_secs)
 {
 	int r;
-	unsigned int adjust_int, max_checkint;
+	unsigned int adjust_int, checkint, max_checkint;
 	struct config *conf;
 	time_t next_idx, goal_idx;
 
@@ -2652,14 +2646,21 @@  check_path (struct vectors * vecs, struct path * pp, unsigned int ticks,
 		return CHECK_PATH_SKIPPED;
 
 	conf = get_multipath_config();
+	checkint = conf->checkint;
 	max_checkint = conf->max_checkint;
 	adjust_int = conf->adjust_int;
 	put_multipath_config(conf);
 
-	r = do_check_path(vecs, pp);
+	if (pp->checkint == CHECKINT_UNDEF) {
+		condlog(0, "%s: BUG: checkint is not set", pp->dev);
+		pp->checkint = checkint;
+	}
+
+	start_path_check(pp);
+	r = update_path_state(vecs, pp);
 
 	/*
-	 * do_check_path() removed or orphaned the path.
+	 * update_path() removed or orphaned the path.
 	 */
 	if (r == CHECK_PATH_REMOVED || !pp->mpp)
 		return r;