[sheepdog] [PATCH 2/5] sheep: use ec_index to remember strip placement

MORITA Kazutaka morita.kazutaka at gmail.com
Tue Oct 15 19:41:46 CEST 2013


At Fri, 11 Oct 2013 17:17:12 +0800,
Liu Yuan wrote:
> 
> ec_index is used to tag the replica for data striping since for erasure coding,
> each replica are indexed as different strip holders for the object.
> 
> We have no room for ec_index in the struct sd_req so we make use of
> 'uint64_t offset' which effectively we only use its first 32 bits. By squeezing
> ec_index into this field, we won't change the layout of sd_req.
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  include/sheepdog_proto.h |    4 +++-
>  sheep/gateway.c          |    1 +
>  sheep/object_cache.c     |    2 +-
>  sheep/ops.c              |    1 +
>  sheep/plain_store.c      |   19 ++++++++++++++++---
>  sheep/sheep_priv.h       |    3 ++-
>  6 files changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/include/sheepdog_proto.h b/include/sheepdog_proto.h
> index 04399bc..5748f53 100644
> --- a/include/sheepdog_proto.h
> +++ b/include/sheepdog_proto.h
> @@ -129,7 +129,9 @@ struct sd_req {
>  			uint8_t		copy_policy;
>  			uint8_t		reserved[2];
>  			uint32_t	tgt_epoch;
> -			uint64_t	offset;
> +			uint32_t	offset;
> +			uint8_t		ec_index;
> +			uint8_t		__pad[3];

I'd suggest using reserved[0] for ec_index.  Then we can add another
32 bit field in future when it is necessary.

Thanks,

Kazutaka



More information about the sheepdog mailing list