dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: mwilck@suse.com
Cc: dm-devel@redhat.com
Subject: Re: [PATCH 06/11] libmultipath: checkers/prio: allow non-lazy .so loading
Date: Thu, 24 Sep 2020 15:27:14 -0500	[thread overview]
Message-ID: <20200924202714.GI11108@octiron.msp.redhat.com> (raw)
In-Reply-To: <20200924133644.14034-7-mwilck@suse.com>

On Thu, Sep 24, 2020 at 03:36:39PM +0200, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> If compiled with -DLOAD_ALL_SHARED_LIBS, all known prioritizers
> and checkers will be loaded immediately on startup. This is useful
> for determining symbol usage (start executables with LD_BIND_NOW=1).

It seems like you could avoid having to remember to update these arrays
when new checker or prio DSOs are added by just scanning multipath_dir
for all the existing checkers/prioritizers.  On the flip side, I'm not
sure that's worth the extra work, and this way has the benefit of
warning if any expected chekers/priotitizers are missing, so

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>

> ---
>  libmultipath/checkers.c | 17 +++++++++++++++++
>  libmultipath/prio.c     | 22 ++++++++++++++++++++++
>  2 files changed, 39 insertions(+)
> 
> diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
> index f7ddd53..18b1f5e 100644
> --- a/libmultipath/checkers.c
> +++ b/libmultipath/checkers.c
> @@ -7,6 +7,7 @@
>  #include "debug.h"
>  #include "checkers.h"
>  #include "vector.h"
> +#include "util.h"
>  
>  struct checker_class {
>  	struct list_head node;
> @@ -375,7 +376,23 @@ void checker_get(const char *multipath_dir, struct checker *dst,
>  
>  int init_checkers(const char *multipath_dir)
>  {
> +#ifdef LOAD_ALL_SHARED_LIBS
> +	static const char *const all_checkers[] = {
> +		DIRECTIO,
> +		TUR,
> +		HP_SW,
> +		RDAC,
> +		EMC_CLARIION,
> +		READSECTOR0,
> +		CCISS_TUR,
> +	};
> +	unsigned int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(all_checkers); i++)
> +		add_checker_class(multipath_dir, all_checkers[i]);
> +#else
>  	if (!add_checker_class(multipath_dir, DEFAULT_CHECKER))
>  		return 1;
> +#endif
>  	return 0;
>  }
> diff --git a/libmultipath/prio.c b/libmultipath/prio.c
> index 3a718ba..c92bde7 100644
> --- a/libmultipath/prio.c
> +++ b/libmultipath/prio.c
> @@ -20,8 +20,30 @@ unsigned int get_prio_timeout(unsigned int timeout_ms,
>  
>  int init_prio (const char *multipath_dir)
>  {
> +#ifdef LOAD_ALL_SHARED_LIBS
> +	static const char *const all_prios[] = {
> +		PRIO_ALUA,
> +		PRIO_CONST,
> +		PRIO_DATACORE,
> +		PRIO_EMC,
> +		PRIO_HDS,
> +		PRIO_HP_SW,
> +		PRIO_ONTAP,
> +		PRIO_RANDOM,
> +		PRIO_RDAC,
> +		PRIO_WEIGHTED_PATH,
> +		PRIO_SYSFS,
> +		PRIO_PATH_LATENCY,
> +		PRIO_ANA,
> +	};
> +	unsigned int i;
> +
> +	for  (i = 0; i < ARRAY_SIZE(all_prios); i++)
> +		add_prio(multipath_dir, all_prios[i]);
> +#else
>  	if (!add_prio(multipath_dir, DEFAULT_PRIO))
>  		return 1;
> +#endif
>  	return 0;
>  }
>  
> -- 
> 2.28.0

  reply	other threads:[~2020-09-24 20:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 13:36 [PATCH 00/11] multipath-tools: add linker version scripts mwilck
2020-09-24 13:36 ` [PATCH 01/11] libmultipath: find_mpe(): don't match with empty WWID mwilck
2020-09-24 13:36 ` [PATCH 02/11] libmultipath: copy mpp->hwe from pp->hwe mwilck
2020-09-24 20:12   ` Benjamin Marzinski
2020-09-25 16:01     ` Martin Wilck
2020-09-25 16:06       ` Benjamin Marzinski
2020-09-24 13:36 ` [PATCH 03/11] libmultipath: dm_map_present_by_uuid(): fix dm_task_create() call mwilck
2020-09-24 13:36 ` [PATCH 04/11] libdmmp tests: fix compilation mwilck
2020-09-24 13:36 ` [PATCH 05/11] libmultipath: prio: constify some function parameters mwilck
2020-09-24 13:36 ` [PATCH 06/11] libmultipath: checkers/prio: allow non-lazy .so loading mwilck
2020-09-24 20:27   ` Benjamin Marzinski [this message]
2020-09-24 13:36 ` [PATCH 07/11] multipath-tools Makefiles: separate rules for .so and man pages mwilck
2020-09-24 13:36 ` [PATCH 08/11] libmultipath: create separate .so for unit tests mwilck
2020-09-24 23:35   ` Benjamin Marzinski
2020-09-24 13:36 ` [PATCH 09/11] libmultipath: add linker version script mwilck
2020-09-24 13:36 ` [PATCH 10/11] libmpathpersist: " mwilck
2020-09-25  4:00   ` Benjamin Marzinski
2020-09-25 19:52     ` Martin Wilck
2020-09-25 22:10       ` Benjamin Marzinski
     [not found]         ` <20200925223207.GC3384@octiron.msp.redhat.com>
     [not found]           ` <c0a1e44fcc819583d972884aa126c486fc784fa9.camel@suse.com>
2020-09-25 23:22             ` Benjamin Marzinski
2020-09-24 13:36 ` [PATCH 11/11] libmpathcmd: " mwilck
2020-09-25  2:09 ` [PATCH 00/11] multipath-tools: add linker version scripts Benjamin Marzinski
2020-09-25 19:53   ` Martin Wilck

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=20200924202714.GI11108@octiron.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mwilck@suse.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;
as well as URLs for NNTP newsgroup(s).