[sheepdog] [PATCH V4 2/2] collie: optimize 'collie vdi check' command

Yunkai Zhang yunkai.me at gmail.com
Mon Sep 3 12:52:04 CEST 2012


On Mon, Sep 3, 2012 at 6:26 PM, Liu Yuan <namei.unix at gmail.com> wrote:
> On 09/02/2012 08:59 PM, Yunkai Zhang wrote:
>> +int gateway_repair_obj(struct request *req)
>> +{
>> +     struct sd_req fwdhdr, *hdr = &req->rq;
>> +     struct sd_vnode *vnodes[SD_MAX_COPIES];
>> +     struct sd_rsp rsps[SD_MAX_COPIES];
>> +     uint64_t oid = hdr->obj.oid;
>> +     struct node_id *src;
>> +     unsigned wlen;
>> +     int nr_objs;
>> +
>> +     nr_objs = get_obj_copy_number(oid, req->vinfo->nr_zones);
>> +
>> +     oid_to_vnodes(req->vinfo->vnodes, req->vinfo->nr_vnodes,
>> +                   oid, nr_objs, vnodes);
>> +
>> +     src = &vnodes[0]->nid;
>> +     wlen = sizeof(*src);
>> +
>> +     memcpy(&fwdhdr, hdr, sizeof(fwdhdr));
>> +     fwdhdr.opcode = gateway_to_peer_opcode(hdr->opcode);
>> +     fwdhdr.data_length = wlen;
>> +     fwdhdr.flags = SD_FLAG_CMD_WRITE;
>> +
>> +     return forward_request_concurrently(&fwdhdr, src, &wlen,
>> +                                         &vnodes[1], rsps, NULL,
>> +                                         nr_objs - 1);
>> +}
>
> I think we don't need REPAIR opcode, we can simply implement it as
> gateway_read/gateway_write in collie side.

Yes we can do it in this way. But it's not so efficient:

Collie should read the object, even if this object no belong to the
node in collie side, and send it to target nodes. It will make network
traffic increase rapidly in collie's machine.


>
> Thanks,
> Yuan



-- 
Yunkai Zhang
Work at Taobao



More information about the sheepdog mailing list