From patchwork Thu May 18 13:18:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9734291 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 B0EA3600CC for ; Thu, 18 May 2017 13:22:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DE7E2766D for ; Thu, 18 May 2017 13:22:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92C7328731; Thu, 18 May 2017 13:22:05 +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=ham 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 3E0032766D for ; Thu, 18 May 2017 13:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934268AbdERNS7 (ORCPT ); Thu, 18 May 2017 09:18:59 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:48460 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934187AbdERNSw (ORCPT ); Thu, 18 May 2017 09:18:52 -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=8wEldWEcMak9NWdpdJ0UEFBbNTBttkKAYqabdCp3EEU=; b=cymwMLxaMPXO02y5/WHW173Jp 5eqa6QkMz4GLErDgI9K/odSqeWDLGEHVv90kNY3+/AfKYxY0FjdZ8LZiroDE3r3xYTsWf04seE48s 6XGhcM8k2scLGRVk96PE4pqZb237SfxMhgA6OV2bPb+a+opeOijFa3DJ5AjG8Y8K8nUP6l0JXKMml dyICnHtQ+IsKPsZ35CBiRNm0BbR4Iuh4TXUDBOah+hr9AbpYvm9v0AZsr1+3npdr15ZlBo1QARj/M Ku81e77Br3mOp2NUUkYWqLUoUsAqJTzZufw2pO2cHEUgEvP1PrPToUJ0SRZ9EjFQUrt9n2+99skji Exzsp7ouA==; Received: from clnet-p099-196.ikbnet.co.at ([83.175.99.196] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1dBLK7-0000fW-D8; Thu, 18 May 2017 13:18:35 +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 06/15] fs: simplify dio_bio_complete Date: Thu, 18 May 2017 15:18:03 +0200 Message-Id: <20170518131812.22956-7-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170518131812.22956-1-hch@lst.de> References: <20170518131812.22956-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 Only read bio->bi_error once in the common path. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche -- --- fs/direct-io.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index 04247a6c3f73..bb711e4b86c2 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -477,13 +477,12 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio) { struct bio_vec *bvec; unsigned i; - int err; + int err = bio->bi_error; - if (bio->bi_error) + if (err) dio->io_error = -EIO; if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) { - err = bio->bi_error; bio_check_pages_dirty(bio); /* transfers ownership */ } else { bio_for_each_segment_all(bvec, bio, i) { @@ -494,7 +493,6 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio) set_page_dirty_lock(page); put_page(page); } - err = bio->bi_error; bio_put(bio); } return err;