Skip to content

Commit

Permalink
mmc: queue: bring discard_granularity/alignment into line with SCSI
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adrian Hunter authored and Chris Ball committed Jun 25, 2011
1 parent d09408a commit c31b55c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/mmc/card/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card,
mq->queue->limits.max_discard_sectors = UINT_MAX;
if (card->erased_byte == 0)
mq->queue->limits.discard_zeroes_data = 1;
if (!mmc_can_trim(card) && is_power_of_2(card->erase_size)) {
mq->queue->limits.discard_granularity =
card->erase_size << 9;
mq->queue->limits.discard_alignment =
card->erase_size << 9;
}
mq->queue->limits.discard_granularity = card->pref_erase << 9;
if (mmc_can_secure_erase_trim(card))
queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD,
mq->queue);
Expand Down

0 comments on commit c31b55c

Please sign in to comment.