[Devel] [RFC PATCH vz9 v6 07/62] dm-ploop: convert wait_list and wb_batch_llist to use lockless lists
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Thu Jan 16 12:35:55 MSK 2025
On 1/14/25 22:20, Alexander Atanasov wrote:
> On 9.01.25 7:00, Pavel Tikhomirov wrote:
>>
>>
>> On 12/6/24 05:55, Alexander Atanasov wrote:
>>> diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
>>> index a0fe92a592a1..fb49dc7bd7b0 100644
>>> --- a/drivers/md/dm-ploop-map.c
>>> +++ b/drivers/md/dm-ploop-map.c
>>> @@ -382,13 +382,14 @@ static bool ploop_delay_if_md_busy(struct ploop
>>> *ploop, struct md_page *md,
>>> WARN_ON_ONCE(!list_empty(&pio->list));
>>> - write_lock_irqsave(&ploop->bat_rwlock, flags);
>>> + /* lock protects piwb */
>>> + read_lock_irqsave(&ploop->bat_rwlock, flags);
>>> piwb = md->piwb;
>>> if (piwb && (piwb->type != type || test_bit(MD_WRITEBACK, &md-
>>> >status))) {
>>> - list_add_tail(&pio->list, &md->wait_list);
>>> + llist_add((struct llist_node *)(&pio->list), &md->wait_llist);
>>
>> Probably we can have:
>>
>> struct pio {
>> union {
>> struct list_head list;
>> struct llist_node llist;
>> };
>> }
>>
>> And use llist member where we need lock-less lists and use list where
>> we want doubly linked list.
>
>
> tried that - did not work.
> compiler errors from list macros, they do type checking - there is a
> third struct too - struct llist_head.
That is really strange, if you use right name from the union in right
places all type checkings should be satisfied, but maybe I miss something.
>
>
--
Best regards, Tikhomirov Pavel
Senior Software Developer, Virtuozzo.
More information about the Devel
mailing list