Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Coly Li <colyli@suse.de>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-block@vger.kernel.org, Vicente Bergas <vicencb@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Subject: Re: [PATCH v4] mmc: core: don't set limits.discard_granularity as 0
Date: Fri, 02 Oct 2020 08:57:09 -0400	[thread overview]
Message-ID: <yq1pn60g5r4.fsf@ca-mkp.ca.oracle.com> (raw)
In-Reply-To: <20201002013852.51968-1-colyli@suse.de> (Coly Li's message of "Fri, 2 Oct 2020 09:38:52 +0800")


Coly,

> diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
> index 6c022ef0f84d..350d0cc4ee62 100644
> --- a/drivers/mmc/core/queue.c
> +++ b/drivers/mmc/core/queue.c
> @@ -190,7 +190,7 @@ static void mmc_queue_setup_discard(struct request_queue *q,
>  	q->limits.discard_granularity = card->pref_erase << 9;
>  	/* granularity must not be greater than max. discard */
>  	if (card->pref_erase > max_discard)
> -		q->limits.discard_granularity = 0;
> +		q->limits.discard_granularity = SECTOR_SIZE;
>  	if (mmc_can_secure_erase_trim(card))
>  		blk_queue_flag_set(QUEUE_FLAG_SECERASE, q);
>  }

The granularity should probably be set to the logical block size instead
of SECTOR_SIZE. However, looking at mmc_setup_queue() it doesn't appear
the logical block size is read from the CSD until after discard has been
configured. So that will require a bit of code shuffling.

-- 
Martin K. Petersen	Oracle Linux Engineering

  reply	other threads:[~2020-10-02 12:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02  1:38 [PATCH v4] mmc: core: don't set limits.discard_granularity as 0 Coly Li
2020-10-02 12:57 ` Martin K. Petersen [this message]
2020-10-02 13:35   ` Coly Li
2020-10-09  6:28 ` Ulf Hansson

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=yq1pn60g5r4.fsf@ca-mkp.ca.oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=adrian.hunter@intel.com \
    --cc=colyli@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=vicencb@gmail.com \
    /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