summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlava Pestov <sp@daterainc.com>2015-02-13 13:44:28 -0800
committerSlava Pestov <sp@daterainc.com>2015-02-13 13:45:53 -0800
commit7ae21650533593d7660a57ebae9f9457dd51b80d (patch)
tree7b242daf94cd19234eadb86f6dfd7b953cf9ef71
parenteb1d49d3f1232e352c0013c651f6cc4b43d99403 (diff)
bcache-tools: update for superblock changes
Change-Id: I660fef1366005377041cac5d75771d2fdc8c0824
-rw-r--r--bcache.c2
-rw-r--r--bcacheadm.c27
2 files changed, 19 insertions, 10 deletions
diff --git a/bcache.c b/bcache.c
index f5609e0..e84771d 100644
--- a/bcache.c
+++ b/bcache.c
@@ -891,8 +891,6 @@ void show_super_cache(struct cache_sb *sb, bool force_csum)
printf("cache.tier\t%llu\n", CACHE_TIER(m));
printf("cache.replication_set\t%llu\n", CACHE_REPLICATION_SET(m));
- printf("cache.cur_meta_replicas\t%llu\n", REPLICATION_SET_CUR_META_REPLICAS(m));
- printf("cache.cur_data_replicas\t%llu\n", REPLICATION_SET_CUR_DATA_REPLICAS(m));
printf("cache.has_metadata\t%llu\n", CACHE_HAS_METADATA(m));
printf("cache.has_data\t%llu\n", CACHE_HAS_DATA(m));
diff --git a/bcacheadm.c b/bcacheadm.c
index 4e657b5..d6e2d86 100644
--- a/bcacheadm.c
+++ b/bcacheadm.c
@@ -301,6 +301,7 @@ static NihOption options[] = {
int make_bcache(NihCommand *command, char *const *args)
{
int cache_dev_fd[devs];
+ int data_replicas_num, metadata_replicas_num;
int backing_dev_fd[devs];
@@ -332,23 +333,33 @@ int make_bcache(NihCommand *command, char *const *args)
}
if (metadata_replicas) {
- SET_CACHE_SET_META_REPLICAS_WANT(cache_set_sb,
- strtoul_or_die(metadata_replicas,
- CACHE_SET_META_REPLICAS_WANT_MAX,
- "meta replicas"));
+ metadata_replicas_num =
+ strtoul_or_die(metadata_replicas,
+ CACHE_SET_META_REPLICAS_WANT_MAX,
+ "meta replicas");
} else {
- SET_CACHE_SET_META_REPLICAS_WANT(cache_set_sb, 1);
+ metadata_replicas_num = 1;
}
+ SET_CACHE_SET_META_REPLICAS_WANT(cache_set_sb,
+ metadata_replicas_num);
+ SET_CACHE_SET_META_REPLICAS_HAVE(cache_set_sb,
+ metadata_replicas_num);
+
if (data_replicas) {
- SET_CACHE_SET_DATA_REPLICAS_WANT(cache_set_sb,
+ data_replicas_num =
strtoul_or_die(data_replicas,
CACHE_SET_DATA_REPLICAS_WANT_MAX,
- "data replicas"));
+ "data replicas");
} else {
- SET_CACHE_SET_DATA_REPLICAS_WANT(cache_set_sb, 1);
+ data_replicas_num = 1;
}
+ SET_CACHE_SET_DATA_REPLICAS_WANT(cache_set_sb,
+ data_replicas_num);
+ SET_CACHE_SET_DATA_REPLICAS_HAVE(cache_set_sb,
+ data_replicas_num);
+
if (bdev == -1) {
fprintf(stderr, "Please specify -C or -B\n");
exit(EXIT_FAILURE);