All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Mike Snitzer <snitzer@redhat.com>
Cc: Junichi Nomura <j-nomura@ce.jp.nec.com>, dm-devel@redhat.com
Subject: Re: [PATCH 7/7] dm mpath: remove extra nesting in map function when path exists
Date: Tue, 04 Feb 2014 09:43:14 +0100	[thread overview]
Message-ID: <52F0A822.2090009@suse.de> (raw)
In-Reply-To: <1391459326-21569-8-git-send-email-snitzer@redhat.com>

On 02/03/2014 09:28 PM, Mike Snitzer wrote:
> Return early for case when no path exists, this eliminates the need for
> extra nesting for the case when a path exists (the common case).
> 
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> ---
>  drivers/md/dm-mpath.c | 51 +++++++++++++++++++++++++++------------------------
>  1 file changed, 27 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
> index 971fbec..272e7d4 100644
> --- a/drivers/md/dm-mpath.c
> +++ b/drivers/md/dm-mpath.c
> @@ -392,32 +392,35 @@ static int multipath_map(struct dm_target *ti, struct request *clone,
>  
>  	pgpath = m->current_pgpath;
>  
> -	if (pgpath) {
> -		if (__pgpath_busy(pgpath))
> -			goto out_unlock;
> +	if (!pgpath) {
> +		if (!__must_push_back(m))
> +			r = -EIO;	/* Failed */
> +		goto out_unlock;
> +	}
> +
> +	if (__pgpath_busy(pgpath))
> +		goto out_unlock;
>  
> -		if (pg_ready(m)) {
> -			if (set_mapinfo(m, map_context) < 0)
> -				/* ENOMEM, requeue */
> -				goto out_unlock;
> -
> -			bdev = pgpath->path.dev->bdev;
> -			clone->q = bdev_get_queue(bdev);
> -			clone->rq_disk = bdev->bd_disk;
> -			clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
> -			mpio = map_context->ptr;
> -			mpio->pgpath = pgpath;
> -			mpio->nr_bytes = nr_bytes;
> -			if (pgpath->pg->ps.type->start_io)
> -				pgpath->pg->ps.type->start_io(&pgpath->pg->ps,
> -							      &pgpath->path,
> -							      nr_bytes);
> -			r = DM_MAPIO_REMAPPED;
> +	if (pg_ready(m)) {
> +		if (set_mapinfo(m, map_context) < 0)
> +			/* ENOMEM, requeue */
>  			goto out_unlock;
> -		}
> -		__pg_init_all_paths(m, 0);
> -	} else if (!__must_push_back(m))
> -		r = -EIO;	/* Failed */
> +
> +		bdev = pgpath->path.dev->bdev;
> +		clone->q = bdev_get_queue(bdev);
> +		clone->rq_disk = bdev->bd_disk;
> +		clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
> +		mpio = map_context->ptr;
> +		mpio->pgpath = pgpath;
> +		mpio->nr_bytes = nr_bytes;
> +		if (pgpath->pg->ps.type->start_io)
> +			pgpath->pg->ps.type->start_io(&pgpath->pg->ps,
> +						      &pgpath->path,
> +						      nr_bytes);
> +		r = DM_MAPIO_REMAPPED;
> +		goto out_unlock;
> +	}
> +	__pg_init_all_paths(m, 0);
>  
>  out_unlock:
>  	spin_unlock_irqrestore(&m->lock, flags);
> 
But then you should be going full circle and move the now somewhat
lonely statement '__pg_init_all_paths' to the top, inverting the
if (pg_ready(m))
statement.

I'll be redoing the patchset (yet again)

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

  parent reply	other threads:[~2014-02-04  8:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-03 20:28 [PATCH v6 0/7] dm-multipath: push back requests instead of queueing Mike Snitzer
2014-02-03 20:28 ` [PATCH 1/7] dm mpath: do not call pg_init when it is already running Mike Snitzer
2014-02-04  3:25   ` Junichi Nomura
2014-02-03 20:28 ` [PATCH 2/7] dm table: add dm_table_run_md_queue_async Mike Snitzer
2014-02-04  3:27   ` Junichi Nomura
2014-02-03 20:28 ` [PATCH 3/7] dm mpath: push back requests instead of queueing Mike Snitzer
2014-02-04  3:25   ` Junichi Nomura
2014-02-03 20:28 ` [PATCH 4/7] dm mpath: remove process_queued_ios() Mike Snitzer
2014-02-04  3:24   ` Junichi Nomura
2014-02-04  8:18     ` Hannes Reinecke
2014-02-04  8:55       ` Junichi Nomura
2014-02-04  9:08         ` Hannes Reinecke
2014-02-04  9:27           ` Junichi Nomura
2014-02-04  9:45             ` Hannes Reinecke
2014-02-03 20:28 ` [PATCH 5/7] dm mpath: reduce memory pressure when requeuing Mike Snitzer
2014-02-04  3:27   ` Junichi Nomura
2014-02-03 20:28 ` [PATCH 6/7] dm mpath: remove map_io() Mike Snitzer
2014-02-04  3:27   ` Junichi Nomura
2014-02-03 20:28 ` [PATCH 7/7] dm mpath: remove extra nesting in map function when path exists Mike Snitzer
2014-02-04  3:27   ` Junichi Nomura
2014-02-04  8:43   ` Hannes Reinecke [this message]
2014-02-04  7:23 ` [PATCH v6 0/7] dm-multipath: push back requests instead of queueing Hannes Reinecke

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=52F0A822.2090009@suse.de \
    --to=hare@suse.de \
    --cc=dm-devel@redhat.com \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=snitzer@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.