summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2016-02-13 10:01:40 +0800
committerDavid Sterba <dsterba@suse.com>2016-04-28 10:59:13 +0200
commit02feae3c5525771878461b90edd2ba38fd3f5359 (patch)
treeb72d8b33eaec437da2906c021a841399550b656b /fs/btrfs/volumes.c
parent6b526ed70cf189660d009ea6f17af77a9cca0f38 (diff)
downloadlinux-02feae3c5525771878461b90edd2ba38fd3f5359.tar.bz2
btrfs: optimize check for stale device
Optimize check for stale device to only be checked when there is device added or changed. If there is no update to the device, there is no need to call btrfs_free_stale_device(). Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 1421d711629f..2fdd2d3322aa 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -699,7 +699,8 @@ static noinline int device_list_add(const char *path,
* if there is new btrfs on an already registered device,
* then remove the stale device entry.
*/
- btrfs_free_stale_device(device);
+ if (ret > 0)
+ btrfs_free_stale_device(device);
*fs_devices_ret = fs_devices;