From patchwork Tue Jun 13 09:05:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 9783351 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 06A1F60325 for ; Tue, 13 Jun 2017 08:59:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFD14274D1 for ; Tue, 13 Jun 2017 08:59:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3BD22867B; Tue, 13 Jun 2017 08:59:41 +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, UNPARSEABLE_RELAY 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 67ACD274D1 for ; Tue, 13 Jun 2017 08:59:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752578AbdFMI7e (ORCPT ); Tue, 13 Jun 2017 04:59:34 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:23607 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752524AbdFMI7b (ORCPT ); Tue, 13 Jun 2017 04:59:31 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v5D8xTSV011333 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Jun 2017 08:59:29 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v5D8xSsX023316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Jun 2017 08:59:29 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v5D8xSlR011959; Tue, 13 Jun 2017 08:59:28 GMT Received: from arch2.sg.oracle.com (/10.186.101.160) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 13 Jun 2017 01:59:28 -0700 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH 2/3 v2] btrfs: remove redundant null bdev counting during flush submit Date: Tue, 13 Jun 2017 17:05:40 +0800 Message-Id: <1497344741-1135-2-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1497344741-1135-1-git-send-email-anand.jain@oracle.com> References: <1497344741-1135-1-git-send-email-anand.jain@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] 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 There is no extra benefit to count null bdev during submit loop, as these null devices will be anyway checked during command completion device loop just after the submit loop, and as we are holding the device_list_mutex, the device->bdev status won't change in between. Signed-off-by: Anand Jain --- v2: . The tile of this patch is changed from [PATCH 2/2] btrfs: flush error also accounts for its send error also added commit log. . The submit_flush_error is removed in patch 1/3 but it was here before. . Dropped the comments. fs/btrfs/disk-io.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 9fbcfa9ccab7..a9f1c48519dd 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3565,7 +3565,6 @@ static int barrier_all_devices(struct btrfs_fs_info *info) { struct list_head *head; struct btrfs_device *dev; - int errors_send = 0; int errors_wait = 0; int ret; @@ -3574,10 +3573,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info) list_for_each_entry_rcu(dev, head, dev_list) { if (dev->missing) continue; - if (!dev->bdev) { - errors_send++; + if (!dev->bdev) continue; - } if (!dev->in_fs_metadata || !dev->writeable) continue; @@ -3603,7 +3600,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info) } } - if (errors_send || errors_wait) { + if (errors_wait) { /* * At some point we need the status of all disks * to arrive at the volume status. So error checking