From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2130.oracle.com ([141.146.126.79]:60830 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755406AbeAIORa (ORCPT ); Tue, 9 Jan 2018 09:17:30 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w09EGe4x148762 for ; Tue, 9 Jan 2018 14:17:29 GMT Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2fcpfyt3x4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 09 Jan 2018 14:17:29 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w09ECSoc019945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 9 Jan 2018 14:12:29 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w09ECSnC015455 for ; Tue, 9 Jan 2018 14:12:28 GMT From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/6] btrfs: cleanup btrfs_free_stale_device() usage Date: Tue, 9 Jan 2018 22:13:09 +0800 Message-Id: <20180109141314.23795-2-anand.jain@oracle.com> In-Reply-To: <20180109141314.23795-1-anand.jain@oracle.com> References: <20180109141314.23795-1-anand.jain@oracle.com> Sender: linux-btrfs-owner@vger.kernel.org List-ID: We call btrfs_free_stale_device() only when we alloc a new struct btrfs_device (ret=1), so move it closer to where we alloc the new device. Also drop the comments. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 9a04245003ab..7e04cd509ab9 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -782,6 +782,7 @@ static noinline int device_list_add(const char *path, ret = 1; device->fs_devices = fs_devices; + btrfs_free_stale_device(device); } else if (!device->name || strcmp(device->name->str, path)) { /* * When FS is already mounted. @@ -840,13 +841,6 @@ static noinline int device_list_add(const char *path, if (!fs_devices->opened) device->generation = found_transid; - /* - * if there is new btrfs on an already registered device, - * then remove the stale device entry. - */ - if (ret > 0) - btrfs_free_stale_device(device); - *fs_devices_ret = fs_devices; return ret; -- 2.7.0