[Devel] [RFC PATCH vz9 v6 07/62] dm-ploop: convert wait_list and wb_batch_llist to use lockless lists
Alexander Atanasov
alexander.atanasov at virtuozzo.com
Tue Jan 14 17:20:06 MSK 2025
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.
--
Regards,
Alexander Atanasov
More information about the Devel
mailing list