From patchwork Tue Feb 27 04:41:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 10244257 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 1579F60362 for ; Tue, 27 Feb 2018 04:40:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07C112A546 for ; Tue, 27 Feb 2018 04:40:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0672F2A54C; Tue, 27 Feb 2018 04:40:35 +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 6E6E72A53E for ; Tue, 27 Feb 2018 04:40:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751514AbeB0Ekb (ORCPT ); Mon, 26 Feb 2018 23:40:31 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:51996 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbeB0Ekb (ORCPT ); Mon, 26 Feb 2018 23:40:31 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1R4WxGr116693 for ; Tue, 27 Feb 2018 04:40:30 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=eNc6pWVb4O/xeNP6ieb68ZTq3FdUbEGVKUnO2Vg1HFo=; b=Ll6RugLyYIJtzcDJktvJYzpcKunsNNfMmtyuUmQDF7VBOg+LVb/q4BN3PBJgRSXtvITO harwHp/aoN6pvBVB0SVGeCipJusrsmf+xI5Jx5HkeHFmtTMSlZekhHZG1aaNtKTl9LGd d9y0XPnYkDy7Kav0Vd1ntRViYNf5ViDn4We4n8bFyX6Qkp8Rr9AUjQW8zs2FEyIDwkoK xoEeknHZ1uXbW45k5/OWym2iyPkEnCjisD/ysIwJYPjb3/fVGkQsr0hsNrTC5zusFpZn wjPRXLvIxRjNediwk55hyv1ujx89BmZVAjiBBAsfJRcidgMKk2QMQk9/RtE5ermXHcJ+ VA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2gd04y829u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 27 Feb 2018 04:40:30 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1R4eTqN012968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 27 Feb 2018 04:40:29 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1R4eTIH009774 for ; Tue, 27 Feb 2018 04:40:29 GMT Received: from tp.sg.oracle.com (/10.186.49.52) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Feb 2018 20:40:29 -0800 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH v2] btrfs: rename btrfs_close_extra_device to btrfs_free_extra_devids Date: Tue, 27 Feb 2018 12:41:59 +0800 Message-Id: <20180227044159.27975-1-anand.jain@oracle.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20180227043242.26367-1-anand.jain@oracle.com> References: <20180227043242.26367-1-anand.jain@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8816 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=959 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802270050 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 function btrfs_close_extra_devices() is about freeing extra devids which once it may have belonged to this fsid. So rename it and add the comment. The _devid suffix is appropriate as this function won't handle devices which are outside of the fsid being mounted. Signed-off-by: Anand Jain --- v1->v2: fix missing git commit --amend fs/btrfs/disk-io.c | 6 +++--- fs/btrfs/volumes.c | 6 +++++- fs/btrfs/volumes.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 798e602c1834..c82f8a471c32 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2758,10 +2758,10 @@ int open_ctree(struct super_block *sb, } /* - * keep the device that is marked to be the target device for the + * keep the devid that is marked to be the target device for the * dev_replace procedure */ - btrfs_close_extra_devices(fs_devices, 0); + btrfs_free_extra_devids(fs_devices, 0); if (!fs_devices->latest_bdev) { btrfs_err(fs_info, "failed to read devices"); @@ -2824,7 +2824,7 @@ int open_ctree(struct super_block *sb, goto fail_block_groups; } - btrfs_close_extra_devices(fs_devices, 1); + btrfs_free_extra_devids(fs_devices, 1); ret = btrfs_sysfs_add_fsid(fs_devices, NULL); if (ret) { diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f0ebf36f02fd..430e5c2e7e1d 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -896,7 +896,11 @@ static struct btrfs_fs_devices *clone_fs_devices(struct btrfs_fs_devices *orig) return ERR_PTR(-ENOMEM); } -void btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices, int step) +/* + * After we have read the system tree and know devids belonging to + * this fsid, remove the device which does not belong to this fsid. + */ +void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices, int step) { struct btrfs_device *device, *next; struct btrfs_device *latest_dev = NULL; diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index efe4168def6d..9b02791046dc 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -429,7 +429,7 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, struct btrfs_fs_devices **fs_devices_ret); int btrfs_close_devices(struct btrfs_fs_devices *fs_devices); -void btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices, int step); +void btrfs_free_extra_devids(struct btrfs_fs_devices *fs_devices, int step); void btrfs_assign_next_active_device(struct btrfs_fs_info *fs_info, struct btrfs_device *device, struct btrfs_device *this_dev); int btrfs_find_device_missing_or_by_path(struct btrfs_fs_info *fs_info,