diff mbox series

btrfs: Remove alloc_list splice in btrfs_prepare_sprout

Message ID 20200812132646.9638-1-nborisov@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: Remove alloc_list splice in btrfs_prepare_sprout | expand

Commit Message

Nikolay Borisov Aug. 12, 2020, 1:26 p.m. UTC
btrfs_prepare_sprout is called when the first rw device is added to a
seed filesystem. This means the filesystem can't have its alloc_list
be non-empty, since seed filesystems are read only. Simply remove the
code altogether.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/volumes.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Josef Bacik Aug. 12, 2020, 1:56 p.m. UTC | #1
On 8/12/20 9:26 AM, Nikolay Borisov wrote:
> btrfs_prepare_sprout is called when the first rw device is added to a
> seed filesystem. This means the filesystem can't have its alloc_list
> be non-empty, since seed filesystems are read only. Simply remove the
> code altogether.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
>   fs/btrfs/volumes.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 71480175e8cb..4bae30b9c944 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -2385,10 +2385,6 @@ static int btrfs_prepare_sprout(struct btrfs_fs_info *fs_info)
>   	list_for_each_entry(device, &seed_devices->devices, dev_list)
>   		device->fs_devices = seed_devices;
>   
> -	mutex_lock(&fs_info->chunk_mutex);
> -	list_splice_init(&fs_devices->alloc_list, &seed_devices->alloc_list);
> -	mutex_unlock(&fs_info->chunk_mutex);
> -
>   	fs_devices->seeding = false;
>   	fs_devices->num_devices = 0;
>   	fs_devices->open_devices = 0;
> 

Ok this took me a second, we swap out the seed_devices and the new fs_devices is 
what becomes the main thing for the fs.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
Anand Jain Aug. 14, 2020, 6:29 a.m. UTC | #2
On 12/8/20 9:26 pm, Nikolay Borisov wrote:
> btrfs_prepare_sprout is called when the first rw device is added to a
> seed filesystem. This means the filesystem can't have its alloc_list
> be non-empty, since seed filesystems are read only. Simply remove the
> code altogether.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: Anand Jain <anand.jain@oracle.com>
David Sterba Aug. 26, 2020, 4:11 p.m. UTC | #3
On Wed, Aug 12, 2020 at 04:26:46PM +0300, Nikolay Borisov wrote:
> btrfs_prepare_sprout is called when the first rw device is added to a
> seed filesystem. This means the filesystem can't have its alloc_list
> be non-empty, since seed filesystems are read only. Simply remove the
> code altogether.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Added to the rest of seed patches, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 71480175e8cb..4bae30b9c944 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2385,10 +2385,6 @@  static int btrfs_prepare_sprout(struct btrfs_fs_info *fs_info)
 	list_for_each_entry(device, &seed_devices->devices, dev_list)
 		device->fs_devices = seed_devices;
 
-	mutex_lock(&fs_info->chunk_mutex);
-	list_splice_init(&fs_devices->alloc_list, &seed_devices->alloc_list);
-	mutex_unlock(&fs_info->chunk_mutex);
-
 	fs_devices->seeding = false;
 	fs_devices->num_devices = 0;
 	fs_devices->open_devices = 0;