From patchwork Mon Jan 22 13:29:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 10178537 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 A1AE760224 for ; Mon, 22 Jan 2018 13:31:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81EDC28437 for ; Mon, 22 Jan 2018 13:31:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A24C280FC; Mon, 22 Jan 2018 13:31:19 +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, 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 3F50C280FC for ; Mon, 22 Jan 2018 13:30:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751189AbeAVNaz (ORCPT ); Mon, 22 Jan 2018 08:30:55 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:41292 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751073AbeAVNay (ORCPT ); Mon, 22 Jan 2018 08:30:54 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w0MDQh2W013738 for ; Mon, 22 Jan 2018 13:30:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=ENSWqG2NxToQctkAaSdTzpF2IQckibVLb6puT7ThWOg=; b=ajogQofAxtsGByYwuLXEp1ZlNe+uHOrrChuCXCtz0X4oGlsr6aZ9ocCMHVaLPD1WmCbA /fwb3x193+tAy0pecnwKGJVYOGgp0Ar7gcfR5hITfKC546iuf+R9DFCl55YGQ3Iry2hw TxKdYGG7UPXpeKZuGHq9QGSFh0NBm8O3wcquThpZ+CyROfFs6+jo1kHmzUKZtI8kL9Hh MQLYBy1wpQ7NQcwvlRdfRuQ9mpe8rO+ZE4YhwMu739YONa8vkppBbVehVj2/Lt5Coss8 Q8DcFmnaNGkp+1aT9cdYe3/GJLY59M3Av+BIxV59LYeaD2SYWRQWAtwCEhKNcjIhzx57 /w== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2fngrd83k9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 22 Jan 2018 13:30:53 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w0MDUrqp031780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 22 Jan 2018 13:30:53 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w0MDUrhh004621 for ; Mon, 22 Jan 2018 13:30:53 GMT Received: from localhost.localdomain (/202.156.140.248) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Jan 2018 05:30:52 -0800 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/4] btrfs: set the total_devices in device_list_add() Date: Mon, 22 Jan 2018 21:29:41 +0800 Message-Id: <20180122132943.14729-3-anand.jain@oracle.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20180122132943.14729-1-anand.jain@oracle.com> References: <20180122132943.14729-1-anand.jain@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8781 signatures=668655 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801220193 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 other parent for device_list_add() except for btrfs_scan_one_device(), which would set btrfs_fs_devices::total_devices if device_list_add is successful and this can be done with in device_list_add() itself. Signed-off-by: Anand Jain Reviewed-by: Josef Bacik --- fs/btrfs/volumes.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 3a272ae7f32d..4a4298017fe1 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -846,6 +846,8 @@ static noinline int device_list_add(const char *path, if (!fs_devices->opened) device->generation = found_transid; + fs_devices->total_devices = btrfs_super_num_devices(disk_super); + *fs_devices_ret = fs_devices; return 0; @@ -1187,7 +1189,6 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, struct page *page; int ret; u64 devid; - u64 total_devices; u64 bytenr; /* @@ -1209,12 +1210,9 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, } devid = btrfs_stack_device_id(&disk_super->dev_item); - total_devices = btrfs_super_num_devices(disk_super); mutex_lock(&uuid_mutex); ret = device_list_add(path, disk_super, devid, fs_devices_ret); - if (!ret && fs_devices_ret) - (*fs_devices_ret)->total_devices = total_devices; mutex_unlock(&uuid_mutex); btrfs_release_disk_super(page);