Re: [PATCH 5/5] btrfs: Switch seed device to list api

Anand Jain
2020-09-02T15:58:51Z

The seed of the current sprout should rather be at the head instead of
at the bottom.

> @@ -2397,7 +2381,7 @@ static int btrfs_prepare_sprout(struct btrfs_fs_info *fs_info)
> fs_devices->open_devices = 0;
> fs_devices->missing_devices = 0;
> fs_devices->rotating = false;
> - fs_devices->seed = seed_devices;
> + list_add_tail(&seed_devices->seed_list, &fs_devices->seed_list);

It should be list_add_head.

>
> generate_random_uuid(fs_devices->fsid);
> memcpy(fs_devices->metadata_uuid, fs_devices->fsid, BTRFS_FSID_SIZE);

> @@ -6728,8 +6718,8 @@ static struct btrfs_fs_devices *open_seed_devices(struct btrfs_fs_info *fs_info,
> goto out;
> }
>
> - fs_devices->seed = fs_info->fs_devices->seed;
> - fs_info->fs_devices->seed = fs_devices;
> + ASSERT(list_empty(&fs_devices->seed_list));
> + list_add_tail(&fs_devices->seed_list, &fs_info->fs_devices->seed_list);

It should be list_add_head.

> out:
> return fs_devices;
> }

Thanks, Anand