From: Adrian Hunter <adrian.hunter@intel.com>
To: Chris Ball <cjb@laptop.org>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>
Subject: [PATCH 4/4] mmc: queue: bring discard_granularity/alignment into line with SCSI definitions
Date: Thu, 23 Jun 2011 13:40:29 +0300 [thread overview]
Message-ID: <1308825629-27375-5-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1308825629-27375-1-git-send-email-adrian.hunter@intel.com>
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>
---
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 3e2db1c..6413afa 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,
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);
--
1.7.4.4
next prev parent reply other threads:[~2011-06-23 10:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-23 10:40 [PATCH 0/4] Minor MMC fixes Adrian Hunter
2011-06-23 10:40 ` [PATCH 1/4] mmc: block: switch card to User Data Area when removing the block driver Adrian Hunter
2011-06-23 10:40 ` [PATCH 2/4] mmc: core: make erase timeout calculation allow for gated clock Adrian Hunter
2011-06-23 10:40 ` [PATCH 3/4] mmc: queue: append partition subname to queue thread name Adrian Hunter
2011-06-24 2:44 ` Jaehoon Chung
2011-06-23 10:40 ` Adrian Hunter [this message]
2011-06-25 22:54 ` [PATCH 0/4] Minor MMC fixes Chris Ball
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1308825629-27375-5-git-send-email-adrian.hunter@intel.com \
--to=adrian.hunter@intel.com \
--cc=cjb@laptop.org \
--cc=linux-mmc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox