All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Alasdair Kergon <agk@redhat.com>
Cc: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>,
	Christoph Hellwig <hch@infradead.org>,
	dm-devel@redhat.com, Mike Snitzer <snitzer@redhat.com>
Subject: [PATCH 6/7] dm: open-code free_rq_clone()
Date: Thu,  5 Jun 2014 15:11:06 +0200	[thread overview]
Message-ID: <1401973867-121561-7-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1401973867-121561-1-git-send-email-hare@suse.de>

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/md/dm.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index b2240f7..4da9941 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -866,23 +866,13 @@ static void rq_completed(struct mapped_device *md, int rw, int run_queue)
 	dm_put(md);
 }
 
-static void free_rq_clone(struct request *clone)
-{
-	struct dm_rq_target_io *tio = clone->end_io_data;
-
-	blk_rq_unprep_clone(clone);
-	free_rq_tio(tio);
-}
-
 /*
  * Complete the clone and the original request.
  * Must be called without queue lock.
  */
-static void dm_end_request(struct request *clone, int error)
+static void dm_end_request(struct request *clone, struct request *rq,
+			   int error)
 {
-	struct dm_rq_target_io *tio = clone->end_io_data;
-	struct request *rq = tio->orig;
-
 	if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
 		rq->errors = clone->errors;
 		rq->resid_len = clone->resid_len;
@@ -896,7 +886,6 @@ static void dm_end_request(struct request *clone, int error)
 			rq->sense_len = clone->sense_len;
 	}
 
-	free_rq_clone(clone);
 	blk_end_request_all(rq, error);
 }
 
@@ -967,14 +956,16 @@ static void dm_done(struct request *clone, struct dm_rq_target_io *tio,
 			r = rq_end_io(tio->ti, clone, tio->error, &tio->info);
 	}
 
+	free_rq_tio(tio);
 	if (r <= 0) {
 		/* The target wants to complete the I/O */
-		dm_end_request(clone, r);
+		dm_end_request(clone, rq, r);
+		blk_rq_unprep_clone(clone);
 		rq_completed(md, rw, true);
 	} else if (r == DM_ENDIO_REQUEUE) {
 		/* The target wants to requeue the I/O */
-		free_rq_clone(clone);
 		dm_requeue_unmapped_request(rq);
+		blk_rq_unprep_clone(clone);
 		rq_completed(md, rw, false);
 	} else {
 		DMWARN("unimplemented target endio return value: %d", r);
@@ -1601,7 +1592,8 @@ static int map_request(struct dm_target *ti, struct request *clone,
 		break;
 	case DM_MAPIO_REQUEUE:
 		/* The target wants to requeue the I/O */
-		free_rq_clone(clone);
+		free_rq_tio(tio);
+		blk_rq_unprep_clone(clone);
 		dm_requeue_unmapped_request(rq);
 		rq_completed(md, rw, false);
 		requeued = 1;
-- 
1.7.12.4

  parent reply	other threads:[~2014-06-05 13:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 13:11 [RFC PATCH 0/7] dm-mpath: Do not clone requests Hannes Reinecke
2014-06-05 13:11 ` [PATCH 1/7] dm: use dm_rq_target_io as argument for dm_done() Hannes Reinecke
2014-06-05 13:11 ` [PATCH 2/7] dm: remove handling of DM_ENDIO_INCOMPLETE Hannes Reinecke
2014-06-05 13:11 ` [PATCH 3/7] dm: move rq_completed() out of enclosing functions Hannes Reinecke
2014-06-05 13:11 ` [PATCH 4/7] dm: open-code dm_kill_unmapped_request() Hannes Reinecke
2014-06-05 13:11 ` [PATCH 5/7] dm: move free_rq_clone() out of dm_unprep_request() Hannes Reinecke
2014-06-05 13:11 ` Hannes Reinecke [this message]
2014-06-05 13:11 ` [PATCH 7/7] dm: do not clone requests Hannes Reinecke
2014-06-05 13:36 ` [RFC PATCH 0/7] dm-mpath: Do " Christoph Hellwig
2014-06-05 13:55   ` Hannes Reinecke
2014-06-05 14:44     ` Christoph Hellwig
2014-06-06  5:25       ` Junichi Nomura
2014-06-05 14:01   ` Mike Snitzer
2014-06-05 14:40     ` 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=1401973867-121561-7-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    --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.