[sheepdog] 答复: [PATCH v2] sheep: do COW at local node for just one time

无觉 wujue.yht at taobao.com
Thu Jul 12 08:40:35 CEST 2012


Hi Yuan,

With short threads, there is no dead lock for this problem.

Do COW at gateway, not on every replication. I think this can decrease I/O and increase performance. Do you think we still need this patch?

Thanks
Wujue

-----邮件原件-----
发件人: Liu Yuan [mailto:namei.unix at gmail.com]
发送时间: 2012年6月27日 13:50
收件人: yaohaiting.wujue at gmail.com
抄送: sheepdog at lists.wpkg.org; 无觉
主题: Re: [sheepdog] [PATCH v2] sheep: do COW at local node for just one time

On 06/27/2012 11:05 AM, yaohaiting.wujue at gmail.com wrote:
> From: HaiTing Yao <wujue.yht at taobao.com>
>
> Node A receives a COW write request, and then forward the request to
> replica nodes B, C, D. Nodes B, C, D do COW separately. On some
> conditions, nodes B, C, D maybe need read base data from node A. Now
> node A is waiting for the reply from B, C, D. If the I/O threads are
> busy, there is dead lock.
>
> Signed-off-by: HaiTing Yao <wujue.yht at taobao.com>
> ---
>  sheep/gateway.c    |   43 +++++++++++++++++++++++++++++++++++++++++++
>  sheep/ops.c        |    2 +-
>  sheep/sheep_priv.h |    3 +++
>  3 files changed, 47 insertions(+), 1 deletions(-)
>
> diff --git a/sheep/gateway.c b/sheep/gateway.c
> index 42f028a..dfee8f3 100644
> --- a/sheep/gateway.c
> +++ b/sheep/gateway.c
> @@ -208,6 +208,42 @@ err:
>       return ret;
>  }
>
> +static int do_cow_at_gateway(struct request *req)
> +{
> +     int ret = 0;
> +     char *buf = NULL;
> +
> +     dprintf("%" PRIx64 ", %" PRIx64 "\n", req->rq.obj.oid,
> +             req->rq.obj.cow_oid);
> +
> +     buf = valloc(SD_DATA_OBJ_SIZE);
> +     if (!buf) {
> +             eprintf("can not allocate memory\n");
> +             return -1;
> +     }
> +
> +     if (req->rq.data_length != SD_DATA_OBJ_SIZE) {
> +             ret = read_copy_from_replica(req->vnodes, req->rq.epoch,
> +                     req->rq.obj.cow_oid, buf);

Indentation.

Wha's the expected indentation?

Thanks



> +             if (ret != SD_RES_SUCCESS) {
> +                     eprintf("failed to read cow object\n");
> +                     free(buf);
> +                     return -1;
> +             }
> +
> +             memcpy(buf + req->rq.obj.offset, req->data,
> +                     req->rq.data_length);
> +

Ditto

> +             free(req->data);
> +             req->data = buf;
> +
> +             req->rq.data_length = SD_DATA_OBJ_SIZE;
> +             req->rq.obj.offset = 0;
> +     }
> +
> +     return ret;
> +}
> +
>  void do_gateway_request(struct work *work)
>  {
>       struct request *req = container_of(work, struct request, work);
> @@ -216,6 +252,13 @@ void do_gateway_request(struct work *work)
>       dprintf("%x, %" PRIx64" , %u\n",
>               req->rq.opcode, req->rq.obj.oid, req->rq.epoch);
>
> +     if ((req->rq.flags & SD_FLAG_CMD_WRITE) &&
> +             (req->rq.flags & SD_FLAG_CMD_COW)) {

ditto.

Also here We should document fallback of the failure and why we fallback.

Thanks,
Yuan

________________________________

This email (including any attachments) is confidential and may be legally privileged. If you received this email in error, please delete it immediately and do not copy it or use it for any purpose or disclose its contents to any other person. Thank you.

本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。


More information about the sheepdog mailing list