summaryrefslogtreecommitdiff
path: root/bcache.c
diff options
context:
space:
mode:
authorJacob Malevich <jam@daterainc.com>2015-01-07 19:01:06 -0800
committerJacob Malevich <jam@daterainc.com>2015-01-12 16:42:26 -0800
commitcbf0900b35d1f6861c81260627593cfa2065b451 (patch)
tree934f9364c7c3522ff2892935da312266b1fe3ffc /bcache.c
parentd7d289efaf6620f87a2686a25a00e78b26a1a9a8 (diff)
bcacheadm: fix variable bucket size input
If the user added n caches but <n bucket_sizes, print a message saying that cache# will be using the default bucket_size Change-Id: I025474ca672bf79d1c88813e6f030ba7590e820d Signed-off-by: Jacob Malevich <jam@daterainc.com>
Diffstat (limited to 'bcache.c')
-rw-r--r--bcache.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/bcache.c b/bcache.c
index 2bc32c0..f64fda7 100644
--- a/bcache.c
+++ b/bcache.c
@@ -582,10 +582,18 @@ void write_cache_sbs(int *fds, struct cache_sb *sb,
for (i = 0; i < sb->nr_in_set; i++) {
struct cache_member *m = sb->members + i;
- if (num_bucket_sizes <= 1)
+ if (num_bucket_sizes <= 1) {
sb->bucket_size = bucket_sizes[0];
- else
- sb->bucket_size = bucket_sizes[i];
+ } else {
+ if (!bucket_sizes[i]) {
+ printf("No bucket size specified for cache %d,"
+ " using the default of %d",
+ i, bucket_sizes[0]);
+ sb->bucket_size = bucket_sizes[0];
+ } else {
+ sb->bucket_size = bucket_sizes[i];
+ }
+ }
SET_CACHE_BTREE_NODE_SIZE(sb, min_size);