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

Nikolay Borisov
2020-09-03T09:03:49Z

On 2.09.20 г. 18:58 ч., Anand Jain wrote:
>
>
> 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.

Generally yes, but in this case I don't think it makes any functional
differences so even adding at the tail is fine.

>
>>         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
>