linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bcache-tools: only discard cache device during making when discard is enabled
@ 2021-06-16 15:12 Coly Li
  0 siblings, 0 replies; only message in thread
From: Coly Li @ 2021-06-16 15:12 UTC (permalink / raw)
  To: linux-bcache; +Cc: Coly Li, Shaoxiong Li

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 <colyli@suse.de>
Cc: Shaoxiong Li <dahefanteng@gmail.com>
---
 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);
 		putchar('\n');
 	}
 
-- 
2.26.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-16 15:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 15:12 [PATCH] bcache-tools: only discard cache device during making when discard is enabled Coly Li

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).