aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/queue.c
diff options
context:
space:
mode:
authorVincent Whitchurch <[email protected]>2022-04-29 15:21:18 +0000
committerUlf Hansson <[email protected]>2022-05-10 10:51:32 +0000
commitf7b6fc327327698924ef3afa0c3e87a5b7466af3 (patch)
tree6aa61b8fbeea6dfaa3a3f1270bb3df23e81e1fd5 /drivers/mmc/core/queue.c
parentmmc: sdhci-brcmstb: Fix compiler warning (diff)
downloadkernel-f7b6fc327327698924ef3afa0c3e87a5b7466af3.tar.gz
kernel-f7b6fc327327698924ef3afa0c3e87a5b7466af3.zip
mmc: core: Support zeroout using TRIM for eMMC
If an eMMC card supports TRIM and indicates that it erases to zeros, we can use it to support hardware offloading of REQ_OP_WRITE_ZEROES, so let's add support for this. Signed-off-by: Vincent Whitchurch <[email protected]> Reviewed-by: Avri Altman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
Diffstat (limited to 'drivers/mmc/core/queue.c')
-rw-r--r--drivers/mmc/core/queue.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index c69b2d9df6f1..bbe2ea829ea7 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -191,6 +191,8 @@ static void mmc_queue_setup_discard(struct request_queue *q,
q->limits.discard_granularity = SECTOR_SIZE;
if (mmc_can_secure_erase_trim(card))
blk_queue_flag_set(QUEUE_FLAG_SECERASE, q);
+ if (mmc_can_trim(card) && card->erased_byte == 0)
+ blk_queue_max_write_zeroes_sectors(q, max_discard);
}
static unsigned short mmc_get_max_segments(struct mmc_host *host)