[Devel] [PATCH vz9 v1 08/63] dm-ploop: convert the rest of the lists to use llist variant

Alexander Atanasov alexander.atanasov at virtuozzo.com
Tue Feb 4 09:39:37 MSK 2025


On 4.02.25 8:30, Pavel Tikhomirov wrote:
> 
> 
> On 2/3/25 14:50, Alexander Atanasov wrote:
>> On 31.01.25 10:32, Pavel Tikhomirov wrote:
>>>
>>>
>>> On 1/24/25 23:35, Alexander Atanasov wrote:
>>>> @@ -353,23 +352,20 @@ static void ploop_dispatch_pio(struct ploop 
>>>> *ploop, struct pio *pio,
>>>>       else
>>>>           *is_data = true;
>>>> -    list_add_tail(&pio->list, list);
>>>> +    llist_add((struct llist_node *)(&pio->list), list);
>>>>   }
>>>
>>> I still believe that proper enum should be added to pio structure, so 
>>> that we have separate pio->llist for llist operations and pio->list 
>>> for list operations.
>>>
>>
>> i'd rather check if any list usages are left and change the type which 
>> was the initial goal.
> 
> We definitely need to remove list field if it became unused. But we 
> should not have bad code (which tries to trick the compiler to believe 
> it uses proper type when it does not) while it is yet used.


I mean pio->list is used but it is used only as llist , so type can be 
changed and casts removed. no need to use union.


> 
>> The union /i beleive enum is a lapsus/ didn't worked due to static 
>> type checking in list macros.
> 
> Sorry, I definitely meant s/enum/union/.
> 
> You probably just did something wrong. To prove my point I wrote a 
> simple module which does what I'm talking about and works just fine:
> 
> https://github.com/Snorch/list-union-module

May be, i did.

> 
> You should remove all improper "llist_add((struct llist_node *)" - like 
> uses and replace them with proper union uses.

No, the goal is to only use llist , no need to use union. If there is a 
places left that use list as list.h and not llist.h  /a quick grep shows 
there are none left/ they should be converted and type changed.

-- 
Regards,
Alexander Atanasov



More information about the Devel mailing list