[dm-devel] [PATCH 4/7] multipathd: add "del maps" multipathd command

Martin Wilck Martin.Wilck at suse.com
Thu Jun 18 20:37:20 UTC 2020


On Wed, 2020-06-17 at 19:24 -0500, Benjamin Marzinski wrote:
> This will flush all multipath devices.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
> ---
>  libmultipath/devmapper.c  |  7 +++++--
>  libmultipath/devmapper.h  |  2 +-
>  multipath/main.c          |  2 +-
>  multipathd/cli.c          |  1 +
>  multipathd/cli_handlers.c | 19 +++++++++++++++++++
>  multipathd/cli_handlers.h |  1 +
>  multipathd/main.c         |  3 ++-
>  multipathd/main.h         |  1 +
>  8 files changed, 31 insertions(+), 5 deletions(-)
> 
> diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
> index 682c0038..a5e0d298 100644
> --- a/libmultipath/devmapper.c
> +++ b/libmultipath/devmapper.c
> @@ -991,7 +991,7 @@ dm_flush_map_nopaths(const char * mapname, int
> deferred_remove)
>  
>  #endif
>  
> -int dm_flush_maps (int retries)
> +int dm_flush_maps (int need_suspend, int retries)
>  {
>  	int r = 1;
>  	struct dm_task *dmt;
> @@ -1014,7 +1014,10 @@ int dm_flush_maps (int retries)
>  
>  	r = 0;
>  	do {
> -		r |= dm_suspend_and_flush_map(names->name, retries);
> +		if (need_suspend)
> +			r |= dm_suspend_and_flush_map(names->name,
> retries);
> +		else
> +			r |= dm_flush_map(names->name);

This is fine, but considering the previous discussion, I'd prefer to
get rid of need_suspend and dm_suspend_and_flush_map() entirely. It
would simplify the _dm_flush_map code path significantly.

As we determined that we use the suspend/resume only in multipath
anyway, we could add it there in the "non-delegated" code path.

Thanks,
Martin

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE  Software Solutions Germany GmbH
HRB 36809, AG Nürnberg GF: Felix
Imendörffer






More information about the dm-devel mailing list