* [Qemu-devel] make use of copy_policy
@ 2013-10-16 7:38 Liu Yuan
2013-10-16 7:38 ` [Qemu-devel] [PATCH 1/2] sheepdog: explicitly set copies as type uint8_t Liu Yuan
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Liu Yuan @ 2013-10-16 7:38 UTC (permalink / raw
To: qemu-devel; +Cc: sheepdog
This patch set makes use of copy_policy in struct SheepdogInode in order to
support recently introduced erasure coding in sheepdog.
Thanks
Yuan
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 1/2] sheepdog: explicitly set copies as type uint8_t
2013-10-16 7:38 [Qemu-devel] make use of copy_policy Liu Yuan
@ 2013-10-16 7:38 ` Liu Yuan
2013-10-23 7:13 ` [Qemu-devel] [sheepdog] " MORITA Kazutaka
2013-10-16 7:38 ` [Qemu-devel] [PATCH 2/2] sheepdog: pass copy_policy in the request Liu Yuan
2013-10-22 8:05 ` [Qemu-devel] make use of copy_policy Liu Yuan
2 siblings, 1 reply; 5+ messages in thread
From: Liu Yuan @ 2013-10-16 7:38 UTC (permalink / raw
To: qemu-devel; +Cc: Kevin Wolf, sheepdog, Stefan Hajnoczi
'copies' is actually uint8_t since day one, but request headers and some helper
functions parameterize it as uint32_t for unknown reasons and effectively
reserve 24 bytes for possible future use. This patch explicitly set the correct
for copies and reserve the left bytes.
This is a preparation patch that allow passing copy_policy in request header.
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
---
block/sheepdog.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 5f81c93..ca4f98b 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -125,7 +125,8 @@ typedef struct SheepdogObjReq {
uint32_t data_length;
uint64_t oid;
uint64_t cow_oid;
- uint32_t copies;
+ uint8_t copies;
+ uint8_t reserved[3];
uint32_t rsvd;
uint64_t offset;
} SheepdogObjReq;
@@ -138,7 +139,8 @@ typedef struct SheepdogObjRsp {
uint32_t id;
uint32_t data_length;
uint32_t result;
- uint32_t copies;
+ uint8_t copies;
+ uint8_t reserved[3];
uint32_t pad[6];
} SheepdogObjRsp;
@@ -151,7 +153,8 @@ typedef struct SheepdogVdiReq {
uint32_t data_length;
uint64_t vdi_size;
uint32_t vdi_id;
- uint32_t copies;
+ uint8_t copies;
+ uint8_t reserved[3];
uint32_t snapid;
uint32_t pad[3];
} SheepdogVdiReq;
@@ -1081,7 +1084,7 @@ static int coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
return 0;
}
-static int read_write_object(int fd, char *buf, uint64_t oid, int copies,
+static int read_write_object(int fd, char *buf, uint64_t oid, uint8_t copies,
unsigned int datalen, uint64_t offset,
bool write, bool create, uint32_t cache_flags)
{
@@ -1129,7 +1132,7 @@ static int read_write_object(int fd, char *buf, uint64_t oid, int copies,
}
}
-static int read_object(int fd, char *buf, uint64_t oid, int copies,
+static int read_object(int fd, char *buf, uint64_t oid, uint8_t copies,
unsigned int datalen, uint64_t offset,
uint32_t cache_flags)
{
@@ -1137,7 +1140,7 @@ static int read_object(int fd, char *buf, uint64_t oid, int copies,
false, cache_flags);
}
-static int write_object(int fd, char *buf, uint64_t oid, int copies,
+static int write_object(int fd, char *buf, uint64_t oid, uint8_t copies,
unsigned int datalen, uint64_t offset, bool create,
uint32_t cache_flags)
{
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/2] sheepdog: pass copy_policy in the request
2013-10-16 7:38 [Qemu-devel] make use of copy_policy Liu Yuan
2013-10-16 7:38 ` [Qemu-devel] [PATCH 1/2] sheepdog: explicitly set copies as type uint8_t Liu Yuan
@ 2013-10-16 7:38 ` Liu Yuan
2013-10-22 8:05 ` [Qemu-devel] make use of copy_policy Liu Yuan
2 siblings, 0 replies; 5+ messages in thread
From: Liu Yuan @ 2013-10-16 7:38 UTC (permalink / raw
To: qemu-devel; +Cc: Kevin Wolf, sheepdog, Stefan Hajnoczi
Currently copy_policy isn't used. Recent sheepdog supports erasure coding, which
make use of copy_policy internally, but require client explicitly passing
copy_policy from base inode to newly creately inode for snapshot related
operations.
If connected sheep daemon doesn't utilize copy_policy, passing it to sheep
daemon is just one extra null effect operation. So no compatibility problem.
With this patch, sheepdog can provide erasure coded volume for QEMU VM.
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
---
block/sheepdog.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index ca4f98b..48b11da 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -126,7 +126,8 @@ typedef struct SheepdogObjReq {
uint64_t oid;
uint64_t cow_oid;
uint8_t copies;
- uint8_t reserved[3];
+ uint8_t copy_policy;
+ uint8_t reserved[2];
uint32_t rsvd;
uint64_t offset;
} SheepdogObjReq;
@@ -140,7 +141,8 @@ typedef struct SheepdogObjRsp {
uint32_t data_length;
uint32_t result;
uint8_t copies;
- uint8_t reserved[3];
+ uint8_t copy_policy;
+ uint8_t reserved[2];
uint32_t pad[6];
} SheepdogObjRsp;
@@ -154,7 +156,8 @@ typedef struct SheepdogVdiReq {
uint64_t vdi_size;
uint32_t vdi_id;
uint8_t copies;
- uint8_t reserved[3];
+ uint8_t copy_policy;
+ uint8_t reserved[2];
uint32_t snapid;
uint32_t pad[3];
} SheepdogVdiReq;
@@ -1347,7 +1350,8 @@ out:
}
static int do_sd_create(BDRVSheepdogState *s, char *filename, int64_t vdi_size,
- uint32_t base_vid, uint32_t *vdi_id, int snapshot)
+ uint32_t base_vid, uint32_t *vdi_id, int snapshot,
+ uint8_t copy_policy)
{
SheepdogVdiReq hdr;
SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr;
@@ -1377,6 +1381,7 @@ static int do_sd_create(BDRVSheepdogState *s, char *filename, int64_t vdi_size,
hdr.data_length = wlen;
hdr.vdi_size = vdi_size;
+ hdr.copy_policy = copy_policy;
ret = do_req(fd, (SheepdogReq *)&hdr, buf, &wlen, &rlen);
@@ -1529,7 +1534,8 @@ static int sd_create(const char *filename, QEMUOptionParameter *options,
bdrv_unref(bs);
}
- ret = do_sd_create(s, vdi, vdi_size, base_vid, &vid, 0);
+ /* TODO: allow users to specify copy number */
+ ret = do_sd_create(s, vdi, vdi_size, base_vid, &vid, 0, 0);
if (!prealloc || ret) {
goto out;
}
@@ -1719,7 +1725,7 @@ static int sd_create_branch(BDRVSheepdogState *s)
*/
deleted = sd_delete(s);
ret = do_sd_create(s, s->name, s->inode.vdi_size, s->inode.vdi_id, &vid,
- !deleted);
+ !deleted, s->inode.copy_policy);
if (ret) {
goto out;
}
@@ -2009,7 +2015,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
}
ret = do_sd_create(s, s->name, s->inode.vdi_size, s->inode.vdi_id, &new_vid,
- 1);
+ 1, s->inode.copy_policy);
if (ret < 0) {
error_report("failed to create inode for snapshot. %s",
strerror(errno));
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] make use of copy_policy
2013-10-16 7:38 [Qemu-devel] make use of copy_policy Liu Yuan
2013-10-16 7:38 ` [Qemu-devel] [PATCH 1/2] sheepdog: explicitly set copies as type uint8_t Liu Yuan
2013-10-16 7:38 ` [Qemu-devel] [PATCH 2/2] sheepdog: pass copy_policy in the request Liu Yuan
@ 2013-10-22 8:05 ` Liu Yuan
2 siblings, 0 replies; 5+ messages in thread
From: Liu Yuan @ 2013-10-22 8:05 UTC (permalink / raw
To: qemu-devel; +Cc: Kevin Wolf, sheepdog, Stefan Hajnoczi
On Wed, Oct 16, 2013 at 03:38:36PM +0800, Liu Yuan wrote:
> This patch set makes use of copy_policy in struct SheepdogInode in order to
> support recently introduced erasure coding in sheepdog.
>
> Thanks
> Yuan
Ping ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [sheepdog] [PATCH 1/2] sheepdog: explicitly set copies as type uint8_t
2013-10-16 7:38 ` [Qemu-devel] [PATCH 1/2] sheepdog: explicitly set copies as type uint8_t Liu Yuan
@ 2013-10-23 7:13 ` MORITA Kazutaka
0 siblings, 0 replies; 5+ messages in thread
From: MORITA Kazutaka @ 2013-10-23 7:13 UTC (permalink / raw
To: Liu Yuan; +Cc: Kevin Wolf, sheepdog, qemu-devel, Stefan Hajnoczi
At Wed, 16 Oct 2013 15:38:37 +0800,
Liu Yuan wrote:
>
> 'copies' is actually uint8_t since day one, but request headers and some helper
> functions parameterize it as uint32_t for unknown reasons and effectively
> reserve 24 bytes for possible future use. This patch explicitly set the correct
> for copies and reserve the left bytes.
>
> This is a preparation patch that allow passing copy_policy in request header.
>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Liu Yuan <namei.unix@gmail.com>
> ---
> block/sheepdog.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 5f81c93..ca4f98b 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -125,7 +125,8 @@ typedef struct SheepdogObjReq {
> uint32_t data_length;
> uint64_t oid;
> uint64_t cow_oid;
> - uint32_t copies;
> + uint8_t copies;
> + uint8_t reserved[3];
> uint32_t rsvd;
> uint64_t offset;
> } SheepdogObjReq;
Having both 'reserved' and 'rsvd' looks confusing. I'd suggest
merging them into 'uint8_t reserved[7]'.
Thanks,
Kazutaka
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-23 7:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-16 7:38 [Qemu-devel] make use of copy_policy Liu Yuan
2013-10-16 7:38 ` [Qemu-devel] [PATCH 1/2] sheepdog: explicitly set copies as type uint8_t Liu Yuan
2013-10-23 7:13 ` [Qemu-devel] [sheepdog] " MORITA Kazutaka
2013-10-16 7:38 ` [Qemu-devel] [PATCH 2/2] sheepdog: pass copy_policy in the request Liu Yuan
2013-10-22 8:05 ` [Qemu-devel] make use of copy_policy Liu Yuan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.