[Devel] [RFC PATCH vz9 v6 10/62] dm-ploop: convert the rest of the lists to use llist variant

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Jan 10 11:23:26 MSK 2025



On 1/10/25 16:19, Alexander Atanasov wrote:
> On 10.01.25 10:14, Pavel Tikhomirov wrote:
>>
>>
>> On 12/6/24 05:55, Alexander Atanasov wrote:
>>> @@ -1871,18 +1901,16 @@ static void ploop_submit_embedded_pio(struct 
>>> ploop *ploop, struct pio *pio)
>>>           worker = &ploop->fsync_worker;
>>>       }
>>> -    spin_lock_irqsave(&ploop->deferred_lock, flags);
>>>       if (unlikely(ploop->stop_submitting_pios)) {
>>>           llist_add((struct llist_node *)(&pio->list), &ploop- 
>>> >llsuspended_pios);
>>>           queue = false;
>>> -        goto unlock;
>>> +        goto out;
>>
>> Maybe just return here? We only set queue to false in this branch and 
>> one more where we can just return instead, so we can, probably, also 
>> remove queue variable in this patch.
> 
> To have a single return point in the function, i see there is a return 
> so may be i'll change it to a goto too.

That contradicts Linux Kernel codding style guide:

 > If there is no cleanup needed then just return directly.

https://www.kernel.org/doc/html/v4.10/process/coding-style.html#centralized-exiting-of-functions

> 
>>
>>>       }
>>>       ploop_inc_nr_inflight(ploop, pio);
>>> -    list_add_tail(&pio->list, &ploop->pios[pio->queue_list_id]);
>>> -unlock:
>>> -    spin_unlock_irqrestore(&ploop->deferred_lock, flags);
>>> +    llist_add((struct llist_node *)(&pio->list), &ploop->pios[pio- 
>>> >queue_list_id]);
>>> +out:
>>>       if (queue)
>>>           queue_work(ploop->wq, worker);
>>>   }
>>
> 

-- 
Best regards, Tikhomirov Pavel
Senior Software Developer, Virtuozzo.



More information about the Devel mailing list