diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2011-06-23 06:40:29 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-06-25 18:53:05 -0400 |
commit | c31b55cd4eaf050bb5a15bd8251da1b3c7edeb1c (patch) | |
tree | 75bc885df951307fda9215e33847411f37935c20 /drivers/mmc/card | |
parent | d09408ade08a08a710a247fb52aa50101e73ebf7 (diff) |
mmc: queue: bring discard_granularity/alignment into line with SCSI
SCSI defines discard alignment as the offset to the first
optimal discard. In the case of SD/MMC, that is always zero
which is the default.
SCSI defines discard granularity as a hint of a optimal
discard size. That is much better expressed by the MMC
"preferred erase size" (pref_erase) field.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | drivers/mmc/card/queue.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 3e2db1cf1cbb..6413afa318d2 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -135,12 +135,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, | |||
135 | mq->queue->limits.max_discard_sectors = UINT_MAX; | 135 | mq->queue->limits.max_discard_sectors = UINT_MAX; |
136 | if (card->erased_byte == 0) | 136 | if (card->erased_byte == 0) |
137 | mq->queue->limits.discard_zeroes_data = 1; | 137 | mq->queue->limits.discard_zeroes_data = 1; |
138 | if (!mmc_can_trim(card) && is_power_of_2(card->erase_size)) { | 138 | mq->queue->limits.discard_granularity = card->pref_erase << 9; |
139 | mq->queue->limits.discard_granularity = | ||
140 | card->erase_size << 9; | ||
141 | mq->queue->limits.discard_alignment = | ||
142 | card->erase_size << 9; | ||
143 | } | ||
144 | if (mmc_can_secure_erase_trim(card)) | 139 | if (mmc_can_secure_erase_trim(card)) |
145 | queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD, | 140 | queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD, |
146 | mq->queue); | 141 | mq->queue); |