[sheepdog] [PATCH v3 5/5] extend MAX number of objects
Liu Yuan
namei.unix at gmail.com
Fri Oct 25 05:29:35 CEST 2013
On Thu, Oct 24, 2013 at 05:46:22PM +0800, Robin Dong wrote:
> Add the max number of objects and add new MACRO for index of inode.
>
> Signed-off-by: Robin Dong <sanbai at taobao.com>
> ---
> include/sheepdog_proto.h | 10 ++++++----
> lib/option.c | 3 +++
> lib/sd_inode.c | 38 ++++++++++++++++++++------------------
> 3 files changed, 29 insertions(+), 22 deletions(-)
>
> diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
> index 8c9be31..0f26c5f 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) /* we use the last uint32_t as btree_counter */
> #define SD_MAX_VDI_LEN 256U
> #define SD_MAX_VDI_TAG_LEN 256U
> @@ -108,8 +108,10 @@
> #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_HEADER_SIZE (sizeof(struct sd_inode) - SD_INODE_INDEX_SIZE)
> +#define SD_INODE_DATA_INDEX (1ULL << 20)
> +#define SD_INODE_DATA_INDEX_SIZE (sizeof(uint32_t) * SD_INODE_DATA_INDEX)
> +#define SD_INODE_HEADER_SIZE (sizeof(struct sd_inode) - \
> + SD_INODE_DATA_INDEX_SIZE)
> #define SD_ATTR_OBJ_SIZE (sizeof(struct sheepdog_vdi_attr))
> #define CURRENT_VDI_ID 0
>
> @@ -227,7 +229,7 @@ struct sd_inode {
> uint32_t parent_vdi_id;
> uint32_t child_vdi_id[MAX_CHILDREN];
> uint32_t btree_counter;
> - uint32_t data_vdi_id[MAX_DATA_OBJS];
> + uint32_t data_vdi_id[SD_INODE_DATA_INDEX];
> };
>
> struct sd_extent {
> diff --git a/lib/option.c b/lib/option.c
> index d12c205..a74049b 100644
> --- a/lib/option.c
> +++ b/lib/option.c
> @@ -71,6 +71,9 @@ int option_parse_size(const char *value, uint64_t *ret)
> goto err;
>
> switch (*postfix) {
> + case 'P':
> + case 'p':
> + sizef *= 1024;
> case 'T':
> case 't':
> sizef *= 1024;
Need to update help message of option_parse_size too.
Thanks
Yuan
More information about the sheepdog
mailing list