Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@linux.intel.com (Keith Busch)
Subject: [PATCH v2] nvme: only reconfigure discard if necessary
Date: Wed, 2 May 2018 11:23:19 -0600	[thread overview]
Message-ID: <20180502172319.GK5938@localhost.localdomain> (raw)
In-Reply-To: <c926d596-b193-c592-3767-4d903ccb742d@kernel.dk>

On Wed, May 02, 2018@11:06:54AM -0600, Jens Axboe wrote:
> Currently nvme reconfigures discard for every disk revalidation. This
> is problematic because any O_WRONLY or O_RDWR open will trigger a
> partition scan through udev/systemd, and we will reconfigure discard.
> This blows away any user settings, like discard_max_bytes.
> 
> Only re-configure the user settable settings if we need to.
> 
> Signed-off-by: Jens Axboe <axboe at kernel.dk>

Thanks, applied to nvme-4.18 with a minor modification removing the
redundant QUEUE_FLAG_DISCARD flag set:
  
> +	/* If discard is already enabled, don't reset queue limits */
> +	if (blk_queue_flag_test_and_set(QUEUE_FLAG_DISCARD, queue))
> +		return;
> +
>  	blk_queue_max_discard_sectors(queue, UINT_MAX);
>  	blk_queue_max_discard_segments(queue, NVME_DSM_MAX_RANGES);
>  	blk_queue_flag_set(QUEUE_FLAG_DISCARD, queue);

-  	blk_queue_flag_set(QUEUE_FLAG_DISCARD, queue);

      reply	other threads:[~2018-05-02 17:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 17:06 [PATCH v2] nvme: only reconfigure discard if necessary Jens Axboe
2018-05-02 17:23 ` Keith Busch [this message]

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=20180502172319.GK5938@localhost.localdomain \
    --to=keith.busch@linux.intel.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