[sheepdog] [PATCH v1 5/5] replace structure of inode->data_vdi_id[] from array to btree

Liu Yuan namei.unix at gmail.com
Mon Oct 14 12:44:48 CEST 2013


On Fri, Oct 11, 2013 at 02:20:47PM +0800, Robin Dong wrote:
> Signed-off-by: Robin Dong <sanbai at taobao.com>
> ---
>  include/sheepdog_proto.h |   45 ++++-
>  lib/sd_inode.c           |  443 +++++++++++++++++++++++++++++++++++++++++++++-
>  sheep/vdi.c              |    1 +
>  sheepfs/volume.c         |    2 +-
>  4 files changed, 482 insertions(+), 9 deletions(-)
> 
> diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
> index 2be9bc9..1070728 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,6 +95,7 @@
>  #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 SD_MAX_VDI_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
>  
> @@ -136,7 +140,8 @@ struct sd_req {
>  			uint32_t	base_vdi_id;
>  			uint8_t		copies;
>  			uint8_t		copy_policy;
> -			uint8_t		reserved[2];
> +			uint8_t		store_policy;
> +			uint8_t		reserved;
>  			uint32_t	snapid;
>  		} vdi;
>  
> @@ -209,11 +214,11 @@ struct sd_inode {
>  	char tag[SD_MAX_VDI_TAG_LEN];
>  	uint64_t create_time;
>  	uint64_t snap_ctime;
> -	uint64_t vm_clock_nsec;
> +	uint64_t btree_counter;

Unfortunately, vm_clock_nsec is used by QEMU. You'll need find another place for
it.

Thanks
Yuan



More information about the sheepdog mailing list