[2/2] mmc/block: Override default max_dev_sectors.
diff mbox

Message ID d6a4eec3e416f5b6e3dd63f04812be01c037ec6a.1456847028.git.pawelx.wodkowski@intel.com
State New
Headers show

Commit Message

Pawel Wodkowski March 2, 2016, 8:55 a.m. UTC
From: Mateusz Nowak <mateusz.nowak@intel.com>

Fixes: ca369d51b3e1 ("block/sd: Fix device-imposed transfer length limits")
introduced max_dev_sectors as upper limit for max_hw_sectors. This caused
limitation of maximum block size to default max_dev_sectors value - 127,
causing performance degradation with higher block sizes.

This patch is overriding max_dev_sectors value, so it will be set to
maximum possible value to be used with set block count command,
so 0xffff for eMMC cards, and 0xffffffff for SD cards.

Fixes: ca369d51b3e1 ("block/sd: Fix device-imposed transfer length limits")
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Mateusz Nowak <mateusz.nowak@intel.com>
---
 drivers/mmc/card/queue.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch
diff mbox

diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 6f4323c6d653..9175b8cd54de 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -212,6 +212,16 @@  int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
 	if (mmc_can_erase(card))
 		mmc_queue_setup_discard(mq->queue, card);
 
+	/*
+	 * Set maximum block count accepted by the card.
+	 * For eMMC, this can be 16 bit value,
+	 * for SD, this can be 32 bit value
+	 */
+	if (mmc_card_mmc(card))
+		blk_queue_max_dev_sectors(mq->queue, 0xffff);
+	else if (mmc_card_sd(card))
+		blk_queue_max_dev_sectors(mq->queue, 0xffffffff);
+
 #ifdef CONFIG_MMC_BLOCK_BOUNCE
 	if (host->max_segs == 1) {
 		unsigned int bouncesz;