[Devel] [PATCH vz9 v1 12/63] dm-ploop: fast path execution for reads

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Feb 7 12:45:04 MSK 2025



On 1/24/25 23:35, Alexander Atanasov wrote:
> @@ -1939,11 +1949,45 @@ static void ploop_submit_embedded_pio(struct ploop *ploop, struct pio *pio)
>   	}
>   
>   	ploop_inc_nr_inflight(ploop, pio);
> +
> +	if (pio->queue_list_id == PLOOP_LIST_FLUSH) {
> +		/* Let the FLUSH go last from the queue , do not run here to preserve ordering */
> +		llist_add((struct llist_node *)(&pio->list), &ploop->pios[PLOOP_LIST_PREPARE]);
> +		return;
> +	}
> +
>   	ploop_prepare_one_embedded_pio(ploop, pio, &deferred_pios);
> +	/* check if result is a single pio , so we can try fast path */
> +	if (deferred_pios.first && deferred_pios.first->next == NULL) {
> +		spio = list_entry((struct list_head *)deferred_pios.first, typeof(*spio), list);
> +		INIT_LIST_HEAD(&spio->list);
> +		if (req_op(rq) == REQ_OP_READ) {
> +			unsigned int old_flags = current->flags;
> +
> +			current->flags |= PF_IO_THREAD|PF_LOCAL_THROTTLE|PF_MEMALLOC_NOIO;
> +			ret = ploop_process_one_deferred_bio(ploop, spio);
> +			current->flags = old_flags;
> +			if (ret == 1) {
> +				/* not queued add back to deferreed*/

Small nit: You have a fixup which adds a space here after "deferreed" in 
"[PATCH vz9 v1 40/63] dm-ploop: process pios via runners", we can move 
it in this patch and fix spelling while on it, should probably be 
"deferred".

> +				llist_add((struct llist_node *)(&spio->list),
> +					  &ploop->pios[PLOOP_LIST_DEFERRED]);
> +			} else {
> +				return;
> +			}
> +
> +		} else { /* OP which can not go thru fast path */
> +			INIT_LIST_HEAD(&spio->list);
> +			llist_add((struct llist_node *)(&spio->list),
> +				  &ploop->pios[PLOOP_LIST_DEFERRED]);
> +		}
> +	} else {
> +		struct llist_node *pos, *t;
>   
> -	llist_for_each_safe(pos, t, deferred_pios.first) {
> -		spio = list_entry((struct list_head *)pos, typeof(*pio), list);
> -		llist_add((struct llist_node *)(&spio->list), &ploop->pios[PLOOP_LIST_DEFERRED]);
> +		llist_for_each_safe(pos, t, deferred_pios.first) {
> +			spio = list_entry((struct list_head *)pos, typeof(*pio), list);
> +			llist_add((struct llist_node *)(&spio->list),
> +				  &ploop->pios[PLOOP_LIST_DEFERRED]);
> +		}
>   	}
>   
>   	ploop_schedule_work(ploop);

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



More information about the Devel mailing list