linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: axboe@kernel.dk
Cc: linux-block@vger.kernel.org, dm-devel@redhat.com,
	linux-btrfs@vger.kernel.org
Subject: [PATCH 08/13] dm mpath: merge do_end_io_bio into multipath_end_io_bio
Date: Sat,  3 Jun 2017 09:38:01 +0200	[thread overview]
Message-ID: <20170603073806.2046-9-hch@lst.de> (raw)
In-Reply-To: <20170603073806.2046-1-hch@lst.de>

This simplifies the code and especially the error passing a bit and
will help with the next patch.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/dm-mpath.c | 42 +++++++++++++++---------------------------
 1 file changed, 15 insertions(+), 27 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 3df056b73b66..6d5ebb76149d 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1510,24 +1510,24 @@ static int multipath_end_io(struct dm_target *ti, struct request *clone,
 	return r;
 }
 
-static int do_end_io_bio(struct multipath *m, struct bio *clone,
-			 int error, struct dm_mpath_io *mpio)
+static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone, int error)
 {
+	struct multipath *m = ti->private;
+	struct dm_mpath_io *mpio = get_mpio_from_bio(clone);
+	struct pgpath *pgpath = mpio->pgpath;
 	unsigned long flags;
 
-	if (!error)
-		return 0;	/* I/O complete */
-
-	if (noretry_error(error))
-		return error;
+	if (!error || noretry_error(error))
+		goto done;
 
-	if (mpio->pgpath)
-		fail_path(mpio->pgpath);
+	if (pgpath)
+		fail_path(pgpath);
 
 	if (atomic_read(&m->nr_valid_paths) == 0 &&
 	    !test_bit(MPATHF_QUEUE_IF_NO_PATH, &m->flags)) {
 		dm_report_EIO(m);
-		return -EIO;
+		error = -EIO;
+		goto done;
 	}
 
 	/* Queue for the daemon to resubmit */
@@ -1539,28 +1539,16 @@ static int do_end_io_bio(struct multipath *m, struct bio *clone,
 	if (!test_bit(MPATHF_QUEUE_IO, &m->flags))
 		queue_work(kmultipathd, &m->process_queued_bios);
 
-	return DM_ENDIO_INCOMPLETE;
-}
-
-static int multipath_end_io_bio(struct dm_target *ti, struct bio *clone, int error)
-{
-	struct multipath *m = ti->private;
-	struct dm_mpath_io *mpio = get_mpio_from_bio(clone);
-	struct pgpath *pgpath;
-	struct path_selector *ps;
-	int r;
-
-	BUG_ON(!mpio);
-
-	r = do_end_io_bio(m, clone, error, mpio);
-	pgpath = mpio->pgpath;
+	error = DM_ENDIO_INCOMPLETE;
+done:
 	if (pgpath) {
-		ps = &pgpath->pg->ps;
+		struct path_selector *ps = &pgpath->pg->ps;
+
 		if (ps->type->end_io)
 			ps->type->end_io(ps, &pgpath->path, mpio->nr_bytes);
 	}
 
-	return r;
+	return error;
 }
 
 /*
-- 
2.11.0


  parent reply	other threads:[~2017-06-03  7:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-03  7:37 dedicated error codes for the block layer V3 Christoph Hellwig
2017-06-03  7:37 ` [PATCH 01/13] nvme-lightnvm: use blk_execute_rq in nvme_nvm_submit_user_cmd Christoph Hellwig
2017-06-03  7:37 ` [PATCH 02/13] scsi/osd: don't save block errors into req_results Christoph Hellwig
2017-06-03  7:37 ` [PATCH 03/13] gfs2: remove the unused sd_log_error field Christoph Hellwig
2017-06-03  7:37 ` [PATCH 04/13] dm: fix REQ_RAHEAD handling Christoph Hellwig
2017-06-03  7:37 ` [PATCH 05/13] fs: remove the unused error argument to dio_end_io() Christoph Hellwig
2017-06-03  7:37 ` [PATCH 06/13] fs: simplify dio_bio_complete Christoph Hellwig
2017-06-03  7:38 ` [PATCH 07/13] block_dev: propagate bio_iov_iter_get_pages error in __blkdev_direct_IO Christoph Hellwig
2017-06-03  7:38 ` Christoph Hellwig [this message]
2017-06-03  7:38 ` [PATCH 09/13] dm: don't return errnos from ->map Christoph Hellwig
2017-06-03  7:38 ` [PATCH 10/13] dm: change ->end_io calling convention Christoph Hellwig
2017-06-03  7:38 ` [PATCH 12/13] blk-mq: switch ->queue_rq return value to blk_status_t Christoph Hellwig
2017-06-08 15:42 ` dedicated error codes for the block layer V3 Jens Axboe
2017-06-08 16:00   ` Mike Snitzer
2017-06-09 15:18   ` Mike Snitzer
2017-06-09 15:28     ` Jens Axboe
2017-06-09 15:29 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2017-05-26  8:56 dedicated error codes for the block layer V2 Christoph Hellwig
2017-05-26  8:56 ` [PATCH 08/13] dm mpath: merge do_end_io_bio into multipath_end_io_bio Christoph Hellwig

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=20170603073806.2046-9-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /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).