bcache-tools: only discard cache device during making when discard is enabled
PATCH 1/1 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 protected]>
Cc Shaoxiong Li <[email protected]>
--- make.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
make.c +2 -1
@@ -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' ); }
Signature · 1 line
2.26.2