Re: [PATCH 5/6] btrfs: make btrfs_free_stale_device() to match the path

2018-01-09 Thread Josef Bacik
On Tue, Jan 09, 2018 at 10:13:13PM +0800, Anand Jain wrote:
> From: Anand Jain 
> 
> The btrfs_free_stale_device() is updated to match for the given
> device path and delete it. (It searchs for only unmounted list of
> devices.)
> 
> Signed-off-by: Anand Jain 

Reviewed-by: Josef Bacik 

Thanks,

Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] btrfs: make btrfs_free_stale_device() to match the path

2018-01-09 Thread Anand Jain
From: Anand Jain 

The btrfs_free_stale_device() is updated to match for the given
device path and delete it. (It searchs for only unmounted list of
devices.)

Signed-off-by: Anand Jain 
---
 fs/btrfs/volumes.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 7646f8860096..f87d30aa0e18 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -606,7 +606,7 @@ static void pending_bios_fn(struct btrfs_work *work)
 }
 
 
-static void btrfs_free_stale_device(struct btrfs_device *cur_dev)
+static void btrfs_free_stale_device(struct btrfs_device *cur_dev, char *path)
 {
struct btrfs_fs_devices *fs_devs, *tmp_fs_devs;
struct btrfs_device *dev, *tmp_dev;
@@ -633,6 +633,8 @@ static void btrfs_free_stale_device(struct btrfs_device 
*cur_dev)
if (cur_dev)
not_found = strcmp(rcu_str_deref(dev->name),
   
rcu_str_deref(cur_dev->name));
+   else if (path)
+   not_found = strcmp(rcu_str_deref(dev->name), 
path);
else
not_found = 0;
rcu_read_unlock();
@@ -776,7 +778,7 @@ static noinline int device_list_add(const char *path,
 
ret = 1;
device->fs_devices = fs_devices;
-   btrfs_free_stale_device(device);
+   btrfs_free_stale_device(device, NULL);
} else if (!device->name || strcmp(device->name->str, path)) {
/*
 * When FS is already mounted.
-- 
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] btrfs: make btrfs_free_stale_device() to match the path

2017-12-14 Thread Anand Jain
The btrfs_free_stale_device() is updated to match for the given
device path and delete it. (It searchs for only unmounted list of
devices.)

Signed-off-by: Anand Jain 
---
 fs/btrfs/volumes.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 9aee4f987221..0bf3233859b6 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -608,7 +608,7 @@ static void pending_bios_fn(struct btrfs_work *work)
 }
 
 
-static void btrfs_free_stale_device(struct btrfs_device *cur_dev)
+static void btrfs_free_stale_device(struct btrfs_device *cur_dev, char *path)
 {
struct btrfs_fs_devices *fs_devs, *tmp_fs_devs;
struct btrfs_device *dev, *tmp_dev;
@@ -635,6 +635,8 @@ static void btrfs_free_stale_device(struct btrfs_device 
*cur_dev)
if (cur_dev)
not_found = strcmp(rcu_str_deref(dev->name),
   
rcu_str_deref(cur_dev->name));
+   else if (path)
+   not_found = strcmp(rcu_str_deref(dev->name), 
path);
else
not_found = 0;
rcu_read_unlock();
@@ -782,7 +784,7 @@ static noinline int device_list_add(const char *path,
 
ret = 1;
device->fs_devices = fs_devices;
-   btrfs_free_stale_device(device);
+   btrfs_free_stale_device(device, NULL);
} else if (!device->name || strcmp(device->name->str, path)) {
/*
 * When FS is already mounted.
-- 
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html