On 9/27/21 7:17 AM, Hao Xu wrote: > add a helper to merge two wq_lists, it will be useful in the next > patches. > > Signed-off-by: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx> > --- > fs/io-wq.h | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/fs/io-wq.h b/fs/io-wq.h > index 8369a51b65c0..7510b05d4a86 100644 > --- a/fs/io-wq.h > +++ b/fs/io-wq.h > @@ -39,6 +39,26 @@ static inline void wq_list_add_after(struct io_wq_work_node *node, > list->last = node; > } > > +/** > + * wq_list_merge - merge the second list to the first one. > + * @list0: the first list > + * @list1: the second list > + * after merge, list0 contains the merged list. > + */ > +static inline void wq_list_merge(struct io_wq_work_list *list0, > + struct io_wq_work_list *list1) > +{ > + if (!list1) > + return; > + > + if (!list0) { > + list0 = list1; It assigns a local var and returns, the assignment will be compiled out, something is wrong > + return; > + } > + list0->last->next = list1->first; > + list0->last = list1->last; > +} > + > static inline void wq_list_add_tail(struct io_wq_work_node *node, > struct io_wq_work_list *list) > { > -- Pavel Begunkov