Skip to contentSkip to conversation

bcache-tools: make: permit only one cache device to be specified

PATCH In review Coly Li 2 participants 2 messages Aug 22, 2020 – Aug 25, 2020 bcache (block layer cache)

lore
Share & tools
lore

Coly Li

author
#0 lore raw

PATCH 1/1 bcache-tools: make: permit only one cache device to be specified

Now a cache set only has a single cache, therefore "bache make" should permit only one cache device to be specified for a cache set.

This patch checks if more than one cache devices are specified by "-C" an error message "Please specify only one cache device" will be printed and bcache exits with usage information.

---
 make.c | 5 +++++
 1 file changed, 5 insertions(+)
make.c +5 -0
index 9631857..ad89377 100644
@@ -604,6 +604,11 @@ int make_bcache(int argc, char **argv)
 		usage();
 	}
 
+	if (ncache_devices > 1) {
+		fprintf(stderr, "Please specify only one cache device\n");
+		usage();
+	}
+
 	if (bucket_size < block_size) {
 		fprintf(stderr,
 			"Bucket size cannot be smaller than block size\n");
Signature · 1 line
2.26.2
#1 lore raw
Quoted 1 line · Coly Li

Now a cache set only has a single cache, therefore "bache make" should

Typo: "bcache"