mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gwendal Grignou <gwendal@chromium.org>
To: ulf.hansson@linaro.org
Cc: grundler@chromium.org, axboe@kernel.dk,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3] CHROMIUM: mmc: Set pref erase size based on size.
Date: Fri,  3 Jun 2016 09:08:52 -0700	[thread overview]
Message-ID: <1464970132-26197-1-git-send-email-gwendal@chromium.org> (raw)
In-Reply-To: <1464913638-5283-1-git-send-email-gwendal@chromium.org>

If available, eMMC stack uses HC_ERASE_GRP_SIZE as erase size.
The perfererred erase size may need to be bigger to ensure discard
operations are not too slow.
Some high capacity eMMC (64MB) reports erase size to 512kB, resulting in
long discard time.
Calculate prefeerred erase size based on eMMC size.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 v2: fix comments
 v3: rereading the patch, we should not compare to hc_erase_size again,
     it has already been set properly in the caller function.

 drivers/mmc/core/core.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index ef76b1c..bd881a0 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1987,17 +1987,17 @@ void mmc_init_erase(struct mmc_card *card)
 	 * to that size and alignment.
 	 *
 	 * For SD cards that define Allocation Unit size, limit erases to one
-	 * Allocation Unit at a time.  For MMC cards that define High Capacity
-	 * Erase Size, whether it is switched on or not, limit to that size.
-	 * Otherwise just have a stab at a good value.  For modern cards it
-	 * will end up being 4MiB.  Note that if the value is too small, it
-	 * can end up taking longer to erase.
+	 * Allocation Unit at a time.
+	 * For MMC, have a stab at a good value.  For modern cards it
+	 * will end up being 4MiB.
+	 * Note that if the value is too small, it can end up taking longer to
+	 * erase.
+	 * erase_size is already set to High Capacity Erase Size if available
+	 * when this function is called.
 	 */
 	if (mmc_card_sd(card) && card->ssr.au) {
 		card->pref_erase = card->ssr.au;
 		card->erase_shift = ffs(card->ssr.au) - 1;
-	} else if (card->ext_csd.hc_erase_size) {
-		card->pref_erase = card->ext_csd.hc_erase_size;
 	} else if (card->erase_size) {
 		sz = (card->csd.capacity << (card->csd.read_blkbits - 9)) >> 11;
 		if (sz < 128)
-- 
2.8.0.rc3.226.g39d4020

  reply	other threads:[~2016-06-03 16:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23  1:54 RFC: 32-bit __data_len and REQ_DISCARD+REQ_SECURE Grant Grundler
2015-09-24 17:39 ` Grant Grundler
     [not found]   ` <CANEJEGukOKUgRJNPVaeEXpx-REzj8ooSfWdrnRMMCQr6EVaNqQ@mail.gmail.com>
2015-09-28 21:45     ` Fwd: " Grant Grundler
2015-09-29 12:56       ` Gwendal Grignou
2015-10-20 17:53       ` Grant Grundler
2015-10-20 18:57         ` Jeff Moyer
2015-10-21  9:00           ` Ulf Hansson
2015-10-21 17:06             ` Grant Grundler
2015-10-28 22:15             ` Jeff Moyer
2016-06-02 22:56               ` [PATCH] mmc: Set pref erase size based on size Gwendal Grignou
2016-06-03  0:27                 ` [PATCH v2] " Gwendal Grignou
2016-06-03 16:08                   ` Gwendal Grignou [this message]
2016-06-22 15:23                     ` [PATCH v3] CHROMIUM: " Ulf Hansson
2016-06-10 17:02                   ` [PATCH v2] " Grant Grundler
2015-10-21 17:38           ` RFC: 32-bit __data_len and REQ_DISCARD+REQ_SECURE Grant Grundler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464970132-26197-1-git-send-email-gwendal@chromium.org \
    --to=gwendal@chromium.org \
    --cc=axboe@kernel.dk \
    --cc=grundler@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®