[sheepdog] [PATCH v2 6/6] add new MACRO SD_INODE_META_SIZE for sd_inode
Liu Yuan
namei.unix at gmail.com
Wed Oct 16 10:49:57 CEST 2013
On Tue, Oct 15, 2013 at 02:45:40PM +0800, Robin Dong wrote:
> Now the relation between MAX_DATA_OBJS and vdi-size is break, so we need a new
> MACRO SD_INODE_META_SIZE to identify the size of inode->data_vdi_id[] and also
> increase the number of MAX_DATA_OBJS.
>
> Signed-off-by: Robin Dong <sanbai at taobao.com>
> ---
> dog/vdi.c | 8 ++++----
> include/sheepdog_proto.h | 7 ++++---
> lib/option.c | 3 +++
> sheep/ops.c | 2 +-
> sheepfs/volume.c | 2 +-
> 5 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/dog/vdi.c b/dog/vdi.c
> index 11db50e..d9310e1 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -557,7 +557,7 @@ static int vdi_create(int argc, char **argv)
> }
>
> ret = sd_write_object(vid_to_vdi_oid(vid), 0, inode,
> - sizeof(uint32_t) * MAX_DATA_OBJS,
> + SD_INODE_INDEX_SIZE,
> SD_INODE_HEADER_SIZE, 0,
> inode->nr_copies, inode->copy_policy,
> false, true);
> @@ -693,7 +693,7 @@ static int vdi_clone(int argc, char **argv)
> }
>
> ret = sd_write_object(vid_to_vdi_oid(new_vid), 0, new_inode,
> - sizeof(uint32_t) * MAX_DATA_OBJS,
> + SD_INODE_INDEX_SIZE,
> SD_INODE_HEADER_SIZE, 0,
> inode->nr_copies, inode->copy_policy,
> false, true);
> @@ -1339,7 +1339,7 @@ static int vdi_write(int argc, char **argv)
> if (create) {
> ret = sd_write_object(vid_to_vdi_oid(vid), 0,
> (char *)inode + SD_INODE_HEADER_SIZE,
> - sizeof(uint32_t) * MAX_DATA_OBJS,
> + SD_INODE_INDEX_SIZE,
> SD_INODE_HEADER_SIZE,
> flags, inode->nr_copies,
> inode->copy_policy, false, false);
> @@ -1826,7 +1826,7 @@ static int restore_obj(struct obj_backup *backup, uint32_t vid,
> INODE_SET_VDI(inode, backup->idx, vid);
> ret = sd_write_object(vid_to_vdi_oid(vid), 0,
> (char *)inode + SD_INODE_HEADER_SIZE,
> - sizeof(uint32_t) * MAX_DATA_OBJS,
> + SD_INODE_INDEX_SIZE,
> SD_INODE_HEADER_SIZE,
> 0, parent_inode->nr_copies,
> parent_inode->copy_policy, false, true);
> diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
> index a826133..c74e0db 100644
> --- a/include/sheepdog_proto.h
> +++ b/include/sheepdog_proto.h
> @@ -96,7 +96,7 @@
> #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_DATA_OBJS (1ULL << 32)
> #define MAX_CHILDREN (1024U - 1)
need comment why we '-1'
>
> #define SD_MAX_VDI_LEN 256U
> #define SD_MAX_VDI_TAG_LEN 256U
> @@ -108,7 +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_INDEX_SIZE (sizeof(uint32_t) * MAX_DATA_OBJS)
> +#define SD_INODE_META_SIZE (1ULL << 20)
better rename as SD_INODE_DATA_INDEX_SIZE
> +#define SD_INODE_INDEX_SIZE (sizeof(uint32_t) * SD_INODE_META_SIZE)
better rename as SD_INODE_DATA_INDEX_SIZE
Thanks
Yuan
More information about the sheepdog
mailing list