From patchwork Thu Jun 5 13:11:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 4305151 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 03BCA9F1D6 for ; Thu, 5 Jun 2014 13:14:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2FE672034C for ; Thu, 5 Jun 2014 13:14:39 +0000 (UTC) Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mail.kernel.org (Postfix) with ESMTP id 1551020274 for ; Thu, 5 Jun 2014 13:14:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s55DBFQ3030857; Thu, 5 Jun 2014 09:11:15 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s55DBEai005534 for ; Thu, 5 Jun 2014 09:11:14 -0400 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s55DBDcL008010; Thu, 5 Jun 2014 09:11:14 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s55DB9rG001664; Thu, 5 Jun 2014 09:11:09 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A9896AD44; Thu, 5 Jun 2014 13:11:08 +0000 (UTC) From: Hannes Reinecke To: Alasdair Kergon Date: Thu, 5 Jun 2014 15:11:06 +0200 Message-Id: <1401973867-121561-7-git-send-email-hare@suse.de> In-Reply-To: <1401973867-121561-1-git-send-email-hare@suse.de> References: <1401973867-121561-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.95 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: "Jun'ichi Nomura" , Christoph Hellwig , dm-devel@redhat.com, Mike Snitzer Subject: [dm-devel] [PATCH 6/7] dm: open-code free_rq_clone() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Hannes Reinecke --- 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;