[sheepdog] [PATCH 1/6] sheep: use struct vdi_iocb to simplify the vdi_create api
Liu Yuan
namei.unix at gmail.com
Mon Aug 6 08:45:04 CEST 2012
On 08/06/2012 01:59 PM, levin li wrote:
> From: levin li <xingke.lwp at taobao.com>
>
>
> Signed-off-by: levin li <xingke.lwp at taobao.com>
> ---
> sheep/ops.c | 12 ++++++++--
> sheep/sheep_priv.h | 12 +++++++++-
> sheep/vdi.c | 57 +++++++++++++++++++++++++--------------------------
> 3 files changed, 47 insertions(+), 34 deletions(-)
>
> diff --git a/sheep/ops.c b/sheep/ops.c
> index 0cddf66..8793c8d 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -113,11 +113,17 @@ static int cluster_new_vdi(struct request *req)
> const struct sd_req *hdr = &req->rq;
> struct sd_rsp *rsp = &req->rp;
> uint32_t vid = 0, nr_copies = sys->nr_copies;
> + struct vdi_iocb iocb;
> int ret;
>
> - ret = add_vdi(req->data, hdr->data_length,
> - hdr->vdi.vdi_size, &vid, hdr->vdi.base_vdi_id,
> - hdr->vdi.snapid, &nr_copies);
> + iocb.data = req->data;
> + iocb.data_len = hdr->data_length;
> + iocb.size = hdr->vdi.vdi_size;
> + iocb.base_vid = hdr->vdi.base_vdi_id;
> + iocb.is_snapshot = hdr->vdi.snapid;
> + iocb.nr_copies = sys->nr_copies;
> +
> + ret = add_vdi(&iocb, &vid);
>
> rsp->vdi.vdi_id = vid;
> rsp->vdi.copies = nr_copies;
> diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
> index 857cf87..afd8c33 100644
> --- a/sheep/sheep_priv.h
> +++ b/sheep/sheep_priv.h
> @@ -128,6 +128,15 @@ struct siocb {
> uint64_t offset;
> };
>
> +struct vdi_iocb {
> + char *data;
> + int data_len;
use int32_t as is in sd_req.data_length.
Thanks,
Yuan
More information about the sheepdog
mailing list