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

David Sterba
2020-09-10T16:44:54Z

On Thu, Sep 03, 2020 at 05:33:26PM +0800, Anand Jain wrote:
>
>
> On 3/9/20 5:03 pm, Nikolay Borisov wrote:
> >
> >
> > 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.
> >
>
> Hm No. Adding to the head matches to the order of dependency. As it
> was in the while loop.

Following the same order sounds like a better idea to me. If there's
really no differece and we want to add the entry to the tail, then it
would be another patch with proper reasoning. I'll update it to do
list_head.