summaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2018-01-10 13:15:18 +0800
committerDavid Sterba <dsterba@suse.com>2018-01-22 16:08:21 +0100
commit1c94da9dd913e69c67fbc77603d56ffa61e454c2 (patch)
treeb6178d8c1b4048dfb7d63e5eebcb253cc17d5eb8 /fs/btrfs
parente2683fc9d219430f5b78889b50cde7f40efeba7b (diff)
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: Anand Jain <anand.jain@oracle.com> Reviewed-by: Josef Bacik <jbacik@fb.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/volumes.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c831a089471f..11fccf2fcb1f 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;