summaryrefslogtreecommitdiff
path: root/drivers/mmc/core/queue.c
diff options
context:
space:
mode:
authorVincent Whitchurch <vincent.whitchurch@axis.com>2022-04-29 17:21:18 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2022-05-10 12:51:32 +0200
commitf7b6fc327327698924ef3afa0c3e87a5b7466af3 (patch)
tree6aa61b8fbeea6dfaa3a3f1270bb3df23e81e1fd5 /drivers/mmc/core/queue.c
parent0c9ee5ba7555016afd1efc9598c3f83de5d83470 (diff)
downloadlinux-f7b6fc327327698924ef3afa0c3e87a5b7466af3.tar.gz
linux-f7b6fc327327698924ef3afa0c3e87a5b7466af3.tar.bz2
linux-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 <vincent.whitchurch@axis.com> Reviewed-by: Avri Altman <Avri.Altman@wdc.com> Link: https://lore.kernel.org/r/20220429152118.3617303-1-vincent.whitchurch@axis.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
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)