[sheepdog] [PATCH] sheep: fix bug for not saving block_size_shift to cluster config

Teruaki Ishizaki ishizaki.teruaki at lab.ntt.co.jp
Tue Dec 16 11:32:17 CET 2014


This patch fixes bugs that block_size_shift info was forgotten
after cluster shutdown and start sheepdog.

Add block_size_shift info to cluster config file.

Signed-off-by: Teruaki Ishizaki <ishizaki.teruaki at lab.ntt.co.jp>
---
 sheep/config.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sheep/config.c b/sheep/config.c
index 383a1ed..dfad5fd 100644
--- a/sheep/config.c
+++ b/sheep/config.c
@@ -11,7 +11,7 @@
 
 #include "sheep_priv.h"
 
-#define SD_FORMAT_VERSION 0x0005
+#define SD_FORMAT_VERSION 0x0006
 #define SD_CONFIG_SIZE 40
 
 static struct sheepdog_config {
@@ -21,7 +21,7 @@ static struct sheepdog_config {
 	uint8_t store[STORE_LEN];
 	uint8_t shutdown;
 	uint8_t copy_policy;
-	uint8_t __pad;
+	uint8_t block_size_shift;
 	uint16_t version;
 	uint64_t space;
 } config;
@@ -64,6 +64,7 @@ static int get_cluster_config(struct cluster_info *cinfo)
 	cinfo->nr_copies = config.copies;
 	cinfo->flags = config.flags;
 	cinfo->copy_policy = config.copy_policy;
+	cinfo->block_size_shift = config.block_size_shift;
 	memcpy(cinfo->store, config.store, sizeof(config.store));
 
 	return SD_RES_SUCCESS;
@@ -155,6 +156,7 @@ int set_cluster_config(const struct cluster_info *cinfo)
 	config.copies = cinfo->nr_copies;
 	config.copy_policy = cinfo->copy_policy;
 	config.flags = cinfo->flags;
+	config.block_size_shift = cinfo->block_size_shift;
 	memset(config.store, 0, sizeof(config.store));
 	pstrcpy((char *)config.store, sizeof(config.store),
 		(char *)cinfo->store);
-- 
1.7.1




More information about the sheepdog mailing list