From: Anand Jain Date: Sat, 13 Feb 2016 02:01:40 +0000 (+0800) Subject: btrfs: optimize check for stale device X-Git-Tag: v4.7-rc1~85^2~1^2~1^2~10 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=02feae3c5525771878461b90edd2ba38fd3f5359;p=linux.git 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 Signed-off-by: David Sterba --- 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;