[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/17] sheepdog: pass copy_policy in the request
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 13/17] sheepdog: pass copy_policy in the request |
Date: |
Tue, 29 Oct 2013 17:31:05 +0100 |
From: Liu Yuan <address@hidden>
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 <address@hidden>
Cc: Stefan Hajnoczi <address@hidden>
Signed-off-by: Liu Yuan <address@hidden>
Acked-by: MORITA Kazutaka <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/sheepdog.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index b8a2985..9f0757b 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[7];
+ uint8_t copy_policy;
+ uint8_t reserved[6];
uint64_t offset;
} SheepdogObjReq;
@@ -139,7 +140,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;
@@ -153,7 +155,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;
@@ -1346,7 +1349,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;
@@ -1376,6 +1380,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);
@@ -1528,7 +1533,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;
}
@@ -1718,7 +1724,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;
}
@@ -2008,7 +2014,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.8.1.4
- [Qemu-devel] [PULL 02/17] qcow2: Restore total_sectors value in save_vmstate, (continued)
- [Qemu-devel] [PULL 02/17] qcow2: Restore total_sectors value in save_vmstate, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 05/17] block/vpc: check that the image has not been truncated, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 03/17] qcow2: Unset zero_beyond_eof in save_vmstate, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 06/17] qemu-iotests: Test for loading VM state from qcow2, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 07/17] qcow2: Flush image after creation, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 08/17] exec: Fix bounce buffer allocation in address_space_map(), Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 09/17] ide-test: Check what happens with bus mastering disabled, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 10/17] tests: Multiboot mmap test case, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 11/17] block: Don't copy backing file name on error, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 12/17] sheepdog: explicitly set copies as type uint8_t, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 13/17] sheepdog: pass copy_policy in the request,
Kevin Wolf <=
- [Qemu-devel] [PULL 14/17] ahci: fix win7 hang on boot, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 15/17] block: Disable BDRV_O_COPY_ON_READ for the backing file, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 16/17] block: Avoid unecessary drv->bdrv_getlength() calls, Kevin Wolf, 2013/10/29
- [Qemu-devel] [PULL 17/17] qemu-iotests: Fix 051 reference output, Kevin Wolf, 2013/10/29