Re: [PATCH 3/4] libmultipath: cleanup ACT_CREATE code in select_action

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2023-01-31 at 13:34 -0600, Benjamin Marzinski wrote:
> Combine the two separate blocks that set ACT_CREATE into one.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>

Reviewed-by: Martin Wilck <mwilck@xxxxxxxx>

> ---
>  libmultipath/configure.c | 38 +++++++++++++++++---------------------
>  1 file changed, 17 insertions(+), 21 deletions(-)
> 
> diff --git a/libmultipath/configure.c b/libmultipath/configure.c
> index 6811e661..e870e0f6 100644
> --- a/libmultipath/configure.c
> +++ b/libmultipath/configure.c
> @@ -686,33 +686,29 @@ void select_action (struct multipath *mpp,
> const struct _vector *curmp,
>         if (mpp->need_reload || (cmpp && cmpp->need_reload))
>                 force_reload = 1;
>  
> -       if (!cmpp_by_name) {
> -               if (cmpp) {
> -                       condlog(2, "%s: rename %s to %s", mpp->wwid,
> -                               cmpp->alias, mpp->alias);
> -                       strlcpy(mpp->alias_old, cmpp->alias,
> WWID_SIZE);
> -                       mpp->action = ACT_RENAME;
> -                       if (force_reload) {
> -                               mpp->force_udev_reload = 1;
> -                               mpp->action = ACT_FORCERENAME;
> -                       }
> -                       return;
> +       if (!cmpp) {
> +               if (cmpp_by_name) {
> +                       condlog(1, "%s: can't use alias \"%s\" used
> by %s, falling back to WWID",
> +                               mpp->wwid, mpp->alias, cmpp_by_name-
> >wwid);
> +                       /* We can do this because wwid wasn't found
> */
> +                       free(mpp->alias);
> +                       mpp->alias = strdup(mpp->wwid);
>                 }
>                 mpp->action = ACT_CREATE;
> -               condlog(3, "%s: set ACT_CREATE (map does not exist)",
> -                       mpp->alias);
> +               condlog(3, "%s: set ACT_CREATE (map does not
> exist%s)",
> +                       mpp->alias, cmpp_by_name ? ", name changed" :
> "");
>                 return;
>         }
>  
> -       if (!cmpp) {
> -               condlog(1, "%s: can't use alias \"%s\" used by %s,
> falling back to WWID",
> -                       mpp->wwid, mpp->alias, cmpp_by_name->wwid);
> -               /* We can do this because wwid wasn't found */
> -               free(mpp->alias);
> -               mpp->alias = strdup(mpp->wwid);
> -               mpp->action = ACT_CREATE;
> -               condlog(3, "%s: set ACT_CREATE (map does not exist,
> name changed)",
> +       if (!cmpp_by_name) {
> +               condlog(2, "%s: rename %s to %s", mpp->wwid, cmpp-
> >alias,
>                         mpp->alias);
> +               strlcpy(mpp->alias_old, cmpp->alias, WWID_SIZE);
> +               mpp->action = ACT_RENAME;
> +               if (force_reload) {
> +                       mpp->force_udev_reload = 1;
> +                       mpp->action = ACT_FORCERENAME;
> +               }
>                 return;
>         }
>  



--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux