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

Liu Yuan namei.unix at gmail.com
Mon Sep 3 12:26:07 CEST 2012


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.

Thanks,
Yuan



More information about the sheepdog mailing list