From patchwork Thu Feb 9 15:33:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9565085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D7E4E6020C for ; Thu, 9 Feb 2017 16:39:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6A1928575 for ; Thu, 9 Feb 2017 16:39:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB4A328578; Thu, 9 Feb 2017 16:39:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B11B828576 for ; Thu, 9 Feb 2017 16:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752700AbdBIQj0 (ORCPT ); Thu, 9 Feb 2017 11:39:26 -0500 Received: from mail-lf0-f45.google.com ([209.85.215.45]:34917 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbdBIQjZ (ORCPT ); Thu, 9 Feb 2017 11:39:25 -0500 Received: by mail-lf0-f45.google.com with SMTP id n124so5685133lfd.2 for ; Thu, 09 Feb 2017 08:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XW7KvRqBWr3hFy8GfNhHyJ9vA/FQrqihEf8e/iVI+bU=; b=YiSIkY4i3YEIeA+702FdsV1xU3abrDFE4icC/VD6YMjbQB4b6RnDLsnaKgn6ZiQkb8 Pmy7+J3X5LQELchaXX4UluHc29B+sCBqRMp/pIifrkoazBmcn9dSo2f3Xn+DmXCuDS/P p6Bx2waTJNCZ5wQWbDe5B2DCcJuXGIKtvPnWU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XW7KvRqBWr3hFy8GfNhHyJ9vA/FQrqihEf8e/iVI+bU=; b=PcYPo+3YcmdUE/2HRa8wT0IPjUpYXXzvzNFRmbj+vakLvY7O0Oi4pJf7U12bM9NzXX r8ghf+7MyhVsZB7hA4HhbCC0fS/0dLgVkJsRkdaE28GjS3bxpcWi8pJyEnETKnVt2VGK SOezvf+qjP2ZjzIJkc0mzUhAP2udLoU8JU/I2w5kdaxUJ3npvgzlkimgDNP1ycNhbTrP BFrTR/52pioKiVFD/R3FF5PeblYUnqZTWFl2MH7laT9mXy/9+gsaN8gQMmzqd2UFqf/u U4AlUNZbpMcstmk3QD7v6k4ZHFNutcVWJ/zuWD5AUkDWAi7S4MRkOaUZ/LQsNM4GjCLT IgGA== X-Gm-Message-State: AMke39kJ5aJcoYrdiIJmtZrsNpib6+Fie2vZBkbt5yxOLiYYJhvOSeDB4RUAJTT77FJduUUh X-Received: by 10.25.4.9 with SMTP id 9mr1267455lfe.45.1486654486292; Thu, 09 Feb 2017 07:34:46 -0800 (PST) Received: from gnarp.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e86sm3670614lji.32.2017.02.09.07.34.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 07:34:45 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Paolo Valente Cc: Chunyan Zhang , Baolin Wang , linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig , Arnd Bergmann , Linus Walleij Subject: [PATCH 04/16] mmc: core: move the asynchronous post-processing Date: Thu, 9 Feb 2017 16:33:51 +0100 Message-Id: <20170209153403.9730-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170209153403.9730-1-linus.walleij@linaro.org> References: <20170209153403.9730-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This moves the asynchronous post-processing of a request over to the finalization function. The patch has a slight semantic change: Both places will be in the code path for if (host->areq) and in the same sequence, but before this patch, the next request was started before performing post-processing. The effect is that whereas before, the post- and preprocessing happened after starting the next request, now the preprocessing will happen after the request is done and before the next has started which would cut half of the pre/post optimizations out. The idea is to later move the finalization to a worker started by mmc_request_done() and introduce a completion where the code now has a TODO comment so that we can push in a new request as soon as the host has completed the previous one. Signed-off-by: Linus Walleij --- drivers/mmc/core/core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 8dbed198750f..0972c649ea7a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -643,6 +643,9 @@ static enum mmc_blk_status mmc_finalize_areq(struct mmc_host *host) mmc_start_bkops(host->card, true); } + /* Successfully postprocess the old request at this point */ + mmc_post_req(host, host->areq->mrq, 0); + return status; } @@ -687,10 +690,6 @@ struct mmc_async_req *mmc_start_areq(struct mmc_host *host, if (status == MMC_BLK_SUCCESS && areq) start_err = __mmc_start_data_req(host, areq->mrq); - /* Postprocess the old request at this point */ - if (host->areq) - mmc_post_req(host, host->areq->mrq, 0); - /* Cancel a prepared request if it was not started. */ if ((status != MMC_BLK_SUCCESS || start_err) && areq) mmc_post_req(host, areq->mrq, -EINVAL);