bcache-tools: only discard cache device during making when discard is enabled
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 <email@example.com>
Cc: Shaoxiong Li <firstname.lastname@example.org>
diff --git a/make.c b/make.c
index e8840eb..52f54c7 100644
@@ -437,7 +437,8 @@
/* Attempting to discard cache device
- blkdiscard_all(dev, fd);
+ if (discard)
+ blkdiscard_all(dev, fd);