[PATCH] bcache-tools: only discard cache device during making when discard is enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
Cc: Shaoxiong Li <dahefanteng@xxxxxxxxx>
---
 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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux