archive mirror
 help / color / mirror / Atom feed
From: Coly Li <>
Cc: Coly Li <>, Shaoxiong Li <>
Subject: [PATCH] bcache-tools: only discard cache device during making when discard is enabled
Date: Wed, 16 Jun 2021 23:12:49 +0800	[thread overview]
Message-ID: <> (raw)

Currently in cache device making time, discard is always issued onto the
cache device. It is unncessary and might be slow if the cache device is
combined by md raid device (e.g. raid10).

Therefore when making a new cache device, this patch only issue discard
when it is explicitly enabled by --discard option.

Signed-off-by: Coly Li <>
Cc: Shaoxiong Li <>
 make.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/make.c b/make.c
index 4ca7734..34d8011 100644
--- a/make.c
+++ b/make.c
@@ -446,7 +446,8 @@ static void write_sb(char *dev, struct sb_context *sbc, bool bdev, bool force)
 		/* Attempting to discard cache device
-		blkdiscard_all(dev, fd);
+		if (discard)
+			blkdiscard_all(dev, fd);

                 reply	other threads:[~2021-06-16 15:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).