[sheepdog] [PATCH] sheep: remove SD_MAX_COPIES use SD_MAX_REDUNDANCY instead

levin li levin108 at gmail.com
Sun Aug 5 17:09:25 CEST 2012


On 08/05/2012 11:07 PM, Yunkai Zhang wrote:
> On Sun, Aug 5, 2012 at 10:52 PM, levin li <levin108 at gmail.com> wrote:
>> On 08/05/2012 10:33 PM, Yunkai Zhang wrote:
>>> On Sun, Aug 5, 2012 at 10:15 PM, levin li <levin108 at gmail.com> wrote:
>>>> From: levin li <xingke.lwp at taobao.com>
>>>>
>>>> Since there's already SD_MAX_REDUNDANCY defined as the max copies
>>>> number, there's no need to keep the duplicated micro SD_MAX_COPIES
>>>>
>>>> Signed-off-by: levin li <xingke.lwp at taobao.com>
>>>> ---
>>>>  collie/vdi.c             |    2 +-
>>>>  include/internal_proto.h |    1 -
>>>>  include/sheep.h          |    2 +-
>>>>  sheep/farm/trunk.c       |    2 +-
>>>>  sheep/gateway.c          |    4 ++--
>>>>  sheep/ops.c              |    2 +-
>>>>  sheep/recovery.c         |    2 +-
>>>>  sheep/request.c          |    2 +-
>>>>  8 files changed, 8 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/collie/vdi.c b/collie/vdi.c
>>>> index e4f4f65..c277d9c 100644
>>>> --- a/collie/vdi.c
>>>> +++ b/collie/vdi.c
>>>> @@ -800,7 +800,7 @@ static int print_obj_epoch(uint64_t oid)
>>>>         struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
>>>>         unsigned rlen, wlen;
>>>>         struct sd_vnode vnodes[SD_MAX_VNODES];
>>>> -       struct sd_vnode *vnode_buf[SD_MAX_COPIES];
>>>> +       struct sd_vnode *vnode_buf[SD_MAX_REDUNDANCY];
>>>>         struct epoch_log *logs;
>>>>         int vnodes_nr, nr_logs, log_length;
>>>>         char host[128];
>>>> diff --git a/include/internal_proto.h b/include/internal_proto.h
>>>> index 114f98a..2996433 100644
>>>> --- a/include/internal_proto.h
>>>> +++ b/include/internal_proto.h
>>>> @@ -24,7 +24,6 @@
>>>>  #define SD_DEFAULT_REDUNDANCY 3
>>>>  #define SD_MAX_REDUNDANCY 8
>>>>
>>>> -#define SD_MAX_COPIES 16
>>>
>>> I like SD_MAX_COPIES, it's shorter and simpler. I suggest to delete
>>> SD_MAX_REDUNDANCY and rename SD_DEFAULT_REDUNDANCY to
>>> SD_DEFAULT_COPIES.
>>>
>>
>> Well, I've thought about this, and I think SD_DEFAULT_COPIES seems not
>> so clearly to indicate the redundancy level to new users, so I choose
>> SD_MAX_REDUNDANCY and dropped SD_MAX_COPIES
> 
> But our manual introduce *copies* concept to users:
> 
> $ man collie
> ...
> cluster format [-b store] [-c copies] [-m mode] [-a address] [-p port] [-h]
>               This command creates a Sheepdog store.
> ...
> 
> And there are so many variables named nr_copies, such as:
> struct epoch_log {
>         uint64_t ctime;
>         uint64_t time;
>         uint32_t epoch;
>         uint32_t nr_nodes;
>         uint32_t nr_copies;
>         struct sd_node nodes[SD_MAX_NODES];
> };
> 
> struct join_message {
>         uint8_t proto_ver;
>         uint8_t nr_copies;
>         uint16_t nr_nodes;
> ...
> 
> Use xxx_COPIES can keep consistency of naming.
> 
>>
>> thanks,
>>
>> levin
>>
> 
> 
> 

OK, I'd like to take your suggestion, and update this patch

thanks

levin



More information about the sheepdog mailing list