]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
btrfs: optimize check for stale device
authorAnand Jain <anand.jain@oracle.com>
Sat, 13 Feb 2016 02:01:40 +0000 (10:01 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 17 Feb 2016 10:12:05 +0000 (11:12 +0100)
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>
fs/btrfs/volumes.c

index 5e49adb34b2e453689c8cf19711361498b94b12d..20af20b0eaee8ef418214fd267f956586a611f45 100644 (file)
@@ -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;