All of lore.kernel.org
 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] mmc: Set pref erase size based on size.
Date: Thu,  2 Jun 2016 15:56:24 -0700	[thread overview]
Message-ID: <1464908184-20153-1-git-send-email-gwendal@chromium.org> (raw)
In-Reply-To: <x49pozyljvs.fsf@segfault.boston.devel.redhat.com>

If available, eMMC stack uses HC_ERASE_GRP_SIZE as preferred erase size.
However, that size is the minimal size we must use, not the optimal size.
Calculate the optimal size based on whole device size and fall back to
HC_ERASE_GRP_SIZE if too small.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 drivers/mmc/core/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index ef76b1c..2874160 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1996,8 +1996,6 @@ void mmc_init_erase(struct mmc_card *card)
 	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)
@@ -2015,6 +2013,8 @@ void mmc_init_erase(struct mmc_card *card)
 			if (sz)
 				card->pref_erase += card->erase_size - sz;
 		}
+		if (card->ext_csd.hc_erase_size > card->pref_erase)
+			card->pref_erase = card->ext_csd.hc_erase_size;
 	} else
 		card->pref_erase = 0;
 }
-- 
2.8.0.rc3.226.g39d4020

  reply	other threads:[~2016-06-02 22:56 UTC|newest]

Thread overview: 17+ 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-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
2015-10-28 22:15               ` Jeff Moyer
2016-06-02 22:56               ` Gwendal Grignou [this message]
2016-06-03  0:27                 ` [PATCH v2] mmc: Set pref erase size based on size Gwendal Grignou
2016-06-03 16:08                   ` [PATCH v3] CHROMIUM: " Gwendal Grignou
2016-06-22 15:23                     ` 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=1464908184-20153-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.