Commit 1c94da9d authored by Anand Jain's avatar Anand Jain Committed by David Sterba

btrfs: cleanup btrfs_free_stale_device() usage

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: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarJosef Bacik <jbacik@fb.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e2683fc9
...@@ -782,6 +782,7 @@ static noinline int device_list_add(const char *path, ...@@ -782,6 +782,7 @@ static noinline int device_list_add(const char *path,
ret = 1; ret = 1;
device->fs_devices = fs_devices; device->fs_devices = fs_devices;
btrfs_free_stale_device(device);
} else if (!device->name || strcmp(device->name->str, path)) { } else if (!device->name || strcmp(device->name->str, path)) {
/* /*
* When FS is already mounted. * When FS is already mounted.
...@@ -840,13 +841,6 @@ static noinline int device_list_add(const char *path, ...@@ -840,13 +841,6 @@ static noinline int device_list_add(const char *path,
if (!fs_devices->opened) if (!fs_devices->opened)
device->generation = found_transid; 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; *fs_devices_ret = fs_devices;
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment