[Devel] [PATCH vz9 v1 06/63] dm-ploop: convert enospc handling to use lockless lists

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Mon Feb 3 09:01:51 MSK 2025


> @@ -166,7 +171,6 @@ static bool ploop_try_delay_enospc(struct ploop_rq *prq, struct pio *pio)
>   	bool delayed = true;
>   	unsigned long flags;
>   
> -	spin_lock_irqsave(&ploop->deferred_lock, flags);
>   	if (unlikely(ploop->wants_suspend)) {
>   		delayed = false;
>   		goto unlock;
> @@ -176,10 +180,11 @@ static bool ploop_try_delay_enospc(struct ploop_rq *prq, struct pio *pio)
>   
>   	pr_err_once(PL_FMT("underlying disk is almost full"),
>   		ploop_device_name(ploop));
> +	spin_lock_irqsave(&ploop->deferred_lock, flags);
>   	ploop->event_enospc = true;
> -	list_add_tail(&pio->list, &ploop->enospc_pios);
> -unlock:
>   	spin_unlock_irqrestore(&ploop->deferred_lock, flags);
> +	llist_add((struct llist_node *)(&pio->list), &ploop->enospc_pios);
> +unlock:
>   
>   	if (delayed)
>   		mod_timer(&ploop->enospc_timer, jiffies + PLOOP_ENOSPC_TIMEOUT);

Can you please explain why we need to take defered_lock around 
ploop->event_enospc setting after your patch? (It looks that this lock 
does not do anything now.)




More information about the Devel mailing list