Skip to contentSkip to conversation

btrfs: Remove alloc_list splice in btrfs_prepare_sprout

PATCH In review Nikolay Borisov 4 participants 4 messages Aug 12, 2020 – Aug 26, 2020 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: Remove alloc_list splice in btrfs_prepare_sprout

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.

---
 fs/btrfs/volumes.c | 4 ----
 1 file changed, 4 deletions(-)
fs/btrfs/volumes.c +0 -4
index 71480175e8cb..4bae30b9c944 100644
@@ -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;
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Nikolay Borisov

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.

---
  fs/btrfs/volumes.c | 4 ----
  1 file changed, 4 deletions(-)
fs/btrfs/volumes.c +0 -0
index 71480175e8cb..4bae30b9c944 100644

fs/btrfs/volumes.c static int btrfs_prepare_sprout(struct btrfs_fs_info *fs_info) · line 2390

Quoted 10 lines
fs/btrfs/volumes.c +0 -4
@@ -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.

Thanks,

Josef

#3 lore raw
In reply to Nikolay Borisov
Quoted 6 lines · Nikolay Borisov

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.

Added to the rest of seed patches, thanks.