From patchwork Thu Jun 15 16:49:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 9789375 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 34D9F60325 for ; Thu, 15 Jun 2017 16:50:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2751728066 for ; Thu, 15 Jun 2017 16:50:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BB9E28552; Thu, 15 Jun 2017 16:50:36 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 B9F652852E for ; Thu, 15 Jun 2017 16:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752017AbdFOQud (ORCPT ); Thu, 15 Jun 2017 12:50:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:56901 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751818AbdFOQud (ORCPT ); Thu, 15 Jun 2017 12:50:33 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id ECC93AC29 for ; Thu, 15 Jun 2017 16:50:31 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id B45F2DA8FD; Thu, 15 Jun 2017 18:49:27 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: David Sterba Subject: [PATCH 3/5] btrfs: move dev stats accounting out of wait_dev_flush Date: Thu, 15 Jun 2017 18:49:27 +0200 Message-Id: <4d289b92beb5c7d81ba1c6e26a18bcc7868a9f67.1497544265.git.dsterba@suse.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: 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 We should really just wait in wait_dev_flush and let the caller decide what to do with the error value. Signed-off-by: David Sterba --- fs/btrfs/disk-io.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 05ff81ecb887..59a732a13370 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3512,7 +3512,6 @@ static void write_dev_flush(struct btrfs_device *device) */ static int wait_dev_flush(struct btrfs_device *device) { - int ret = 0; struct request_queue *q = bdev_get_queue(device->bdev); struct bio *bio = device->flush_bio; @@ -3521,13 +3520,7 @@ static int wait_dev_flush(struct btrfs_device *device) wait_for_completion_io(&device->flush_wait); - if (bio->bi_error) { - ret = bio->bi_error; - btrfs_dev_stat_inc_and_print(device, - BTRFS_DEV_STAT_FLUSH_ERRS); - } - - return ret; + return bio->bi_error; } static int check_barrier_error(struct btrfs_fs_devices *fsdevs) @@ -3586,6 +3579,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info) ret = wait_dev_flush(dev); if (ret) { dev->last_flush_error = ret; + btrfs_dev_stat_inc_and_print(dev, + BTRFS_DEV_STAT_FLUSH_ERRS); errors_wait++; } }