On Thursday, February 09, 2017 04:33:58 PM Linus Walleij wrote: > Instead of doing retries at the same time as trying to submit new > requests, do the retries when the request is reported as completed > by the driver, in the finalization worker. > > This is achieved by letting the core worker call back into the block > layer using mmc_blk_rw_done(), that will read the status and repeatedly > try to hammer the request using single request etc by calling back to > the core layer using mmc_restart_areq() > > The beauty of it is that the completion will not complete until the > block layer has had the opportunity to hammer a bit at the card using > a bunch of different approaches in the while() loop in > mmc_blk_rw_done() > > The algorithm for recapture, retry and handle errors is essentially > identical to the one we used to have in mmc_blk_issue_rw_rq(), > only augmented to get called in another path. > > We have to add and initialize a pointer back to the struct mmc_queue > from the struct mmc_queue_req to find the queue from the asynchronous > request. > > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> It seems that after this change we can end up queuing more work for kthread from the kthread worker itself and wait inside it for this nested work to complete. I hope that you've tested it with simulating errors and it all works. Under this assumption: Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx> Also some very minor nit: + case MMC_BLK_DATA_ERR: { + int err; + err = mmc_blk_reset(md, host, type); During the code movement CodingStyle suffered. Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html