[sheepdog] [PATCH v6 11/17] sheepdog proto: recycle old child_vdi_id for storing btree_counter
Hitoshi Mitake
mitake.hitoshi at gmail.com
Wed Mar 5 16:28:52 CET 2014
From: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
Now the area isn't used and clients (QEMU and tgt) don't care about
it, we can recycle it for storing the btree_counter.
Cc: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Cc: Valerio Pachera <sirio81 at gmail.com>
Cc: Alessandro Bolgia <alessandro at extensys.it>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
include/sheepdog_proto.h | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
index 796d909..675a8f8 100644
--- a/include/sheepdog_proto.h
+++ b/include/sheepdog_proto.h
@@ -96,7 +96,6 @@
#define LEDGER_BIT (UINT64_C(1) << 59)
#define OLD_MAX_DATA_OBJS (1ULL << 20)
#define MAX_DATA_OBJS (1ULL << 32)
-#define MAX_CHILDREN 1024U
#define SD_MAX_VDI_LEN 256U
#define SD_MAX_VDI_TAG_LEN 256U
#define SD_MAX_VDI_ATTR_KEY_LEN 256U
@@ -219,6 +218,19 @@ struct sd_rsp {
};
};
+/*
+ * Historical notes: previous version of sheepdog (< v0.9.0) has a limit of
+ * maximum number of children which can be created from single VDI. So the inode
+ * object has an array for storing the IDs of the child VDIs. The constant
+ * OLD_MAX_CHILDREN represents it. Current sheepdog doesn't have the limitation,
+ * so we are recycling the area (4 * OLD_MAX_CHILDREN = 4KB) for storing new
+ * metadata.
+ *
+ * users of the released area:
+ * - uint32_t btree_counter
+ */
+#define OLD_MAX_CHILDREN 1024U
+
struct generation_reference {
int32_t generation;
int32_t count;
@@ -239,9 +251,11 @@ struct sd_inode {
uint32_t snap_id;
uint32_t vdi_id;
uint32_t parent_vdi_id;
- uint32_t __unused[MAX_CHILDREN];
- uint32_t data_vdi_id[SD_INODE_DATA_INDEX];
+
uint32_t btree_counter;
+ uint32_t __unused[OLD_MAX_CHILDREN - 1];
+
+ uint32_t data_vdi_id[SD_INODE_DATA_INDEX];
struct generation_reference gref[SD_INODE_DATA_INDEX];
};
--
1.8.3.2
More information about the sheepdog
mailing list