From patchwork Sat Jun 3 07:38:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9763989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18AE860363 for ; Sat, 3 Jun 2017 07:38:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A3CA27F3E for ; Sat, 3 Jun 2017 07:38:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3A16285CE; Sat, 3 Jun 2017 07:38:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAC6927F3E for ; Sat, 3 Jun 2017 07:38:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751209AbdFCHig (ORCPT ); Sat, 3 Jun 2017 03:38:36 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:58259 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbdFCHid (ORCPT ); Sat, 3 Jun 2017 03:38:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=6GCJy+L8JB2lTRiodh3AWed4CyvMNSQ8KH9VEDqEKPs=; b=PwpNP3loRlr4pHtOMjdHzlW1x pwS1fAqD1NP4sQsWSUXPssvelD0K+NZdVm1F+dcG6eFN3Mi9SZz39FLtChRuPrKJP4x2OaxI7F/qq ELbP/bt/geNPrdLEuLX0hqLAbyAgNzKMQlMRYP3FOTtGICOB0wA9DH3uMKfQFHMEkEs+ztosogjE1 Gt7d1mvUaqMRnG3IR0mC12IzEOtvHl3i7FN4ptc0dMqQolPCbwP4KFe6goOyYS8cfauO6OG+KVWLC 4ydEprjCtRdRp09uhhxO4K3ezr79R/6XTimgTeO6RZXjw2Unp+gkbi8imw+lU88U0AKCj5EvbEbw2 fHD9icxDg==; Received: from p4ff2fcbf.dip0.t-ipconnect.de ([79.242.252.191] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1dH3do-0000pe-4e; Sat, 03 Jun 2017 07:38:32 +0000 From: Christoph Hellwig 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 Message-Id: <20170603073806.2046-9-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170603073806.2046-1-hch@lst.de> References: <20170603073806.2046-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This simplifies the code and especially the error passing a bit and will help with the next patch. Signed-off-by: Christoph Hellwig --- 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; } /*