[Devel] [RFC PATCH vz9 v6 28/62] dm-ploop: handle REQ_PREFLUSH
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Tue Jan 14 11:14:13 MSK 2025
On 1/14/25 16:11, Pavel Tikhomirov wrote:
>
>
> On 12/6/24 05:56, Alexander Atanasov wrote:
>> diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
>> index 6b7963f4c426..55c10d21d8eb 100644
>> --- a/drivers/md/dm-ploop-map.c
>> +++ b/drivers/md/dm-ploop-map.c
>> @@ -1973,33 +1973,62 @@ int ploop_worker(void *data)
>> return 0;
>> }
>> +static void ploop_preflush_endio(struct pio *pio, void *orig_pio_ptr,
>> + blk_status_t bi_status)
>> +{
>> + struct pio *original = orig_pio_ptr;
>> +
>> + if (bi_status) {
>> + original->bi_status = bi_status;
>> + ploop_pio_endio(original);
>> + } else {
>> + ploop_dispatch_pios(pio->ploop, original, NULL);
>> + }
>> +}
>> +
>> static void ploop_prepare_flush(struct ploop *ploop, struct pio *pio)
>> {
>> + struct pio *flush_pio = pio;
>> struct md_page *md, *n;
>> int md_inflight = 0;
>> + if (pio->bi_op & REQ_PREFLUSH && (pio->bi_op & REQ_OP_MASK) !=
>> REQ_OP_FLUSH) {
>> + flush_pio = ploop_alloc_pio(ploop, GFP_NOIO);
>> + if (!flush_pio) {
>> + pio->bi_status = BLK_STS_RESOURCE;
>> + ploop_pio_endio(pio);
>> + return;
>> + }
>> +
>> + ploop_init_pio(ploop, REQ_OP_FLUSH, flush_pio);
>> + flush_pio->endio_cb = ploop_preflush_endio;
>> + flush_pio->endio_cb_data = pio;
>> + flush_pio->queue_list_id = PLOOP_LIST_FLUSH;
>> + flush_pio->free_on_endio = true;
>> + }
>> +
>> write_lock_irq(&ploop->bat_rwlock);
>> list_for_each_entry(md, &ploop->wb_batch_list_prio, wb_link) {
>> md_inflight++;
>> - md->piwb->flush_pio = pio;
>> + md->piwb->flush_pio = flush_pio;
>> }
>> list_for_each_entry_safe(md, n, &ploop->wb_batch_list, wb_link) {
>> md_inflight++;
>> - md->piwb->flush_pio = pio;
>> + md->piwb->flush_pio = flush_pio;
>> list_del(&md->wb_link);
>> list_add_tail(&md->wb_link, &ploop->wb_batch_list_prio);
>> }
>> - atomic_set(&pio->md_inflight, md_inflight);
>> + atomic_set(&flush_pio->md_inflight, md_inflight);
>> write_unlock_irq(&ploop->bat_rwlock);
>> if (md_inflight)
>> - queue_work(ploop->wq, &ploop->worker);
>> + ploop_schedule_work(ploop);
>
> Looks like this hunk belongs to "[RFC PATCH vz9 v6 12/62] dm-ploop: WIP
> move from wq to kthread".
Ah, no, probably to "[RFC PATCH vz9 v6 27/62] dm-ploop: submit all
postponed metadata on REQ_OP_FLUSH" instead.
>
>> else
>> - ploop_dispatch_pios(ploop, pio, NULL);
>> + ploop_dispatch_pios(ploop, flush_pio, NULL);
>> }
>> static void ploop_submit_embedded_pio(struct ploop *ploop, struct
>> pio *pio)
>
--
Best regards, Tikhomirov Pavel
Senior Software Developer, Virtuozzo.
More information about the Devel
mailing list