[sheepdog] [PATCH v2 1/2] sheep: don't send vdi_inuse in get_vdis

levin li levin108 at gmail.com
Fri Aug 24 08:20:37 CEST 2012


On 2012年08月24日 14:09, MORITA Kazutaka wrote:
> At Fri, 24 Aug 2012 13:36:46 +0800,
> levin li wrote:
>>
>> From: levin li <xingke.lwp at taobao.com>
>>
>> Since we already send vdi copy list in get_vdis(), there's no
>> need to send the vdi_inuse bitmap any more, without it we can
>> send less data as the length of vdi copy list is variable and
>> it contains the vid just as vdi_inuse does.
>>
>> Signed-off-by: levin li <xingke.lwp at taobao.com>
>> ---
>>  include/internal_proto.h |    1 +
>>  sheep/group.c            |   37 ++++++++++++++++---------------------
>>  sheep/ops.c              |   15 +++++++++++++++
>>  sheep/sheep_priv.h       |    1 +
>>  sheep/vdi.c              |    2 +-
>>  5 files changed, 34 insertions(+), 22 deletions(-)
>>
>> diff --git a/include/internal_proto.h b/include/internal_proto.h
>> index 83d98f1..4fe98e5 100644
>> --- a/include/internal_proto.h
>> +++ b/include/internal_proto.h
>> @@ -63,6 +63,7 @@
>>  #define SD_OP_ENABLE_RECOVER 0xA8
>>  #define SD_OP_DISABLE_RECOVER 0xA9
>>  #define SD_OP_INFO_RECOVER 0xAA
>> +#define SD_OP_GET_VDI_LIST 0xAB
> 
> Is SD_OP_GET_VDI_COPIES better to distinguish it from SD_OP_READ_VDIS
> explicitly?
> 

OK

>>  
>>  /* internal flags for hdr.flags, must be above 0x80 */
>>  #define SD_FLAG_CMD_RECOVERY 0x0080
>> diff --git a/sheep/group.c b/sheep/group.c
>> index bcbd152..5e56d1b 100644
>> --- a/sheep/group.c
>> +++ b/sheep/group.c
>> @@ -618,21 +618,12 @@ static int get_vdis_from(struct sd_node *node)
>>  {
>>  	struct sd_req hdr;
>>  	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
>> -	struct vdi_copy *vc;
>> -	static DECLARE_BITMAP(tmp_vdi_inuse, SD_NR_VDIS);
>> +	struct vdi_copy *vc = NULL;
>>  	int fd, i, ret = SD_RES_SUCCESS;
>> -	unsigned int rlen = SD_NR_VDIS * 3, wlen;
>> +	unsigned int rlen = SD_NR_VDIS, wlen;
> 
> rlen = SD_NR_VDIS * sizeof(*vc)

As we set rlen to SD_NR_VDIS * sizeof(*vc), it means that we need to
allocate 128M memory for such a single request both in client and server,

SD_NR_VDIS = 1 << 24, sizeof(*vc) = 8
then rlen = (2^24) * 8 / (1024 * 1024) = 128M

Does it matter if we need to allocate so much memory for this ?

> 
> In addition, I think we don't need to call fill_vdi_copy_list in
> read_vdis any more.
> 

Well, forgot to remove it, I'd update.

thanks,

levin

> Thanks,
> 
> Kazutaka
> 




More information about the sheepdog mailing list