diff options
author | Jacob Malevich <jam@daterainc.com> | 2015-01-07 19:01:06 -0800 |
---|---|---|
committer | Jacob Malevich <jam@daterainc.com> | 2015-01-12 16:42:26 -0800 |
commit | cbf0900b35d1f6861c81260627593cfa2065b451 (patch) | |
tree | 934f9364c7c3522ff2892935da312266b1fe3ffc /bcache.c | |
parent | d7d289efaf6620f87a2686a25a00e78b26a1a9a8 (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.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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); |