mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-24 10:28:57 +00:00
mmc: Set pref erase size based on size
If available, eMMC stack uses HC_ERASE_GRP_SIZE as the preferred erase size. As some high capacity eMMC (64MB) reports this size to 512kB, the discard operations end up taking very long time. Improve the behaviour by instead calculating the preferred erase size based on the eMMC size. In this way the discard operations becomes faster. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> [Ulf: Updated changelog and improved comment in code] Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
7eb16493ec
commit
c6d8fd61c0
@ -1934,17 +1934,15 @@ void mmc_init_erase(struct mmc_card *card)
|
|||||||
* to that size and alignment.
|
* to that size and alignment.
|
||||||
*
|
*
|
||||||
* For SD cards that define Allocation Unit size, limit erases to one
|
* For SD cards that define Allocation Unit size, limit erases to one
|
||||||
* Allocation Unit at a time. For MMC cards that define High Capacity
|
* Allocation Unit at a time.
|
||||||
* Erase Size, whether it is switched on or not, limit to that size.
|
* For MMC, have a stab at ai good value and for modern cards it will
|
||||||
* Otherwise just have a stab at a good value. For modern cards it
|
* end up being 4MiB. Note that if the value is too small, it can end
|
||||||
* will end up being 4MiB. Note that if the value is too small, it
|
* up taking longer to erase. Also note, erase_size is already set to
|
||||||
* can end up taking longer to erase.
|
* High Capacity Erase Size if available when this function is called.
|
||||||
*/
|
*/
|
||||||
if (mmc_card_sd(card) && card->ssr.au) {
|
if (mmc_card_sd(card) && card->ssr.au) {
|
||||||
card->pref_erase = card->ssr.au;
|
card->pref_erase = card->ssr.au;
|
||||||
card->erase_shift = ffs(card->ssr.au) - 1;
|
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) {
|
} else if (card->erase_size) {
|
||||||
sz = (card->csd.capacity << (card->csd.read_blkbits - 9)) >> 11;
|
sz = (card->csd.capacity << (card->csd.read_blkbits - 9)) >> 11;
|
||||||
if (sz < 128)
|
if (sz < 128)
|
||||||
|
Loading…
Reference in New Issue
Block a user