On Sun, Oct 27, 2013 at 01:54:30AM +0900, MORITA Kazutaka wrote: > At Thu, 24 Oct 2013 17:46:20 +0800, > Robin Dong wrote: > > > > 1. add sd_extent_header to manage meta-data in data_vdi_id[] or middle-node > > 2. add new type of object: B-tree object as middle-node > > > > Signed-off-by: Robin Dong <san...@taobao.com> > > --- > > dog/vdi.c | 2 +- > > include/sheepdog_proto.h | 43 ++++- > > lib/sd_inode.c | 519 > > +++++++++++++++++++++++++++++++++++++++++++++- > > sheep/vdi.c | 1 + > > sheepfs/volume.c | 2 +- > > 5 files changed, 558 insertions(+), 9 deletions(-) > > > > diff --git a/dog/vdi.c b/dog/vdi.c > > index faf06f0..960e2a0 100644 > > --- a/dog/vdi.c > > +++ b/dog/vdi.c > > @@ -558,7 +558,7 @@ static int vdi_create(int argc, char **argv) > > goto out; > > } > > > > - sd_inode_set_vdi(inode, idx, vid); > > + INODE_SET_VDI(inode, idx, vid); > > ret = sd_write_object(vid_to_vdi_oid(vid), 0, &vid, sizeof(vid), > > SD_INODE_HEADER_SIZE + sizeof(vid) * idx, > > 0, inode->nr_copies, inode->copy_policy, > > diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h > > index 30ff397..c338efa 100644 > > --- a/include/sheepdog_proto.h > > +++ b/include/sheepdog_proto.h > > @@ -74,6 +74,9 @@ > > #define SD_RES_JOIN_FAILED 0x18 /* Target node had failed to join > > sheepdog */ > > #define SD_RES_HALT 0x19 /* Sheepdog is stopped doing IO */ > > #define SD_RES_READONLY 0x1A /* Object is read-only */ > > +#define SD_RES_BTREE_NOT_FOUND 0x1B /* Cannot found node in btree */ > > +#define SD_RES_BTREE_FOUND 0x1C /* Found node in btree */ > > +#define SD_RES_BTREE_REPEAT 0x1D /* Should repeat op in btree */ > > > > /* errors above 0x80 are sheepdog-internal */ > > > > @@ -92,8 +95,9 @@ > > #define VDI_BIT (UINT64_C(1) << 63) > > #define VMSTATE_BIT (UINT64_C(1) << 62) > > #define VDI_ATTR_BIT (UINT64_C(1) << 61) > > +#define VDI_BTREE_BIT (UINT64_C(1) << 60) > > #define MAX_DATA_OBJS (1ULL << 20) > > -#define MAX_CHILDREN 1024U > > +#define MAX_CHILDREN (1024U - 1) /* we use the last uint32_t as > > btree_counter */ > > #define SD_MAX_VDI_LEN 256U > > #define SD_MAX_VDI_TAG_LEN 256U > > #define SD_MAX_VDI_ATTR_KEY_LEN 256U > > @@ -104,8 +108,8 @@ > > #define SD_MAX_VDI_SIZE (SD_DATA_OBJ_SIZE * MAX_DATA_OBJS) > > > > #define SD_INODE_SIZE (sizeof(struct sd_inode)) > > -#define SD_INODE_HEADER_SIZE (sizeof(struct sd_inode) - \ > > - sizeof(uint32_t) * MAX_DATA_OBJS) > > +#define SD_INODE_INDEX_SIZE (sizeof(uint32_t) * MAX_DATA_OBJS) > > +#define SD_INODE_HEADER_SIZE (sizeof(struct sd_inode) - > > SD_INODE_INDEX_SIZE) > > #define SD_ATTR_OBJ_SIZE (sizeof(struct sheepdog_vdi_attr)) > > #define CURRENT_VDI_ID 0 > > > > @@ -215,16 +219,35 @@ struct sd_inode { > > uint64_t vdi_size; > > uint64_t vm_state_size; > > uint8_t copy_policy; > > - uint8_t reserved; > > + uint8_t store_policy; > > I wonder if we need another field. Can we share copy_policy and > store_policy? >
Almost every bits of copy_policy is used by erasure code. How can we share it with store_policy? It doesn't look feasible to me. Thanks Yuan -- sheepdog mailing list sheepdog@lists.wpkg.org http://lists.wpkg.org/mailman/listinfo/sheepdog