From cbf1dff2f1033cadcb15c0ffc9c0a3d039d8ed42 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 21 May 2010 11:09:42 +0200 Subject: block: Fix multiwrite with overlapping requests With overlapping requests, the total number of sectors is smaller than the sum of the nb_sectors of both requests. Signed-off-by: Kevin Wolf --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'block.c') diff --git a/block.c b/block.c index cd70730..47be5ba 100644 --- a/block.c +++ b/block.c @@ -2019,7 +2019,7 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs, // Add the second request qemu_iovec_concat(qiov, reqs[i].qiov, reqs[i].qiov->size); - reqs[outidx].nb_sectors += reqs[i].nb_sectors; + reqs[outidx].nb_sectors = qiov->size >> 9; reqs[outidx].qiov = qiov; mcb->callbacks[i].free_qiov = reqs[outidx].qiov; -- cgit v1.1 From b50cbabc1bc12e6b0082089c70015c1b97db86a1 Mon Sep 17 00:00:00 2001 From: MORITA Kazutaka Date: Wed, 26 May 2010 11:35:36 +0900 Subject: add support for protocol driver create_options This patch enables protocol drivers to use their create options which are not supported by the format. For example, protcol drivers can use a backing_file option with raw format. Signed-off-by: MORITA Kazutaka Signed-off-by: Kevin Wolf --- block.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'block.c') diff --git a/block.c b/block.c index 47be5ba..24c63f6 100644 --- a/block.c +++ b/block.c @@ -56,7 +56,6 @@ static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors); static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors); -static BlockDriver *find_protocol(const char *filename); static QTAILQ_HEAD(, BlockDriverState) bdrv_states = QTAILQ_HEAD_INITIALIZER(bdrv_states); @@ -210,7 +209,7 @@ int bdrv_create_file(const char* filename, QEMUOptionParameter *options) { BlockDriver *drv; - drv = find_protocol(filename); + drv = bdrv_find_protocol(filename); if (drv == NULL) { drv = bdrv_find_format("file"); } @@ -283,7 +282,7 @@ static BlockDriver *find_hdev_driver(const char *filename) return drv; } -static BlockDriver *find_protocol(const char *filename) +BlockDriver *bdrv_find_protocol(const char *filename) { BlockDriver *drv1; char protocol[128]; @@ -478,7 +477,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags) BlockDriver *drv; int ret; - drv = find_protocol(filename); + drv = bdrv_find_protocol(filename); if (!drv) { return -ENOENT; } -- cgit v1.1 From 1a396859105c4c27fdec08180be26288b8a629a3 Mon Sep 17 00:00:00 2001 From: "Nicholas A. Bellinger" Date: Thu, 27 May 2010 08:56:28 -0700 Subject: block: Add missing bdrv_delete() for SG_IO BlockDriver in find_image_format() This patch adds a missing bdrv_delete() call in find_image_format() so that a SG_IO BlockDriver properly releases the temporary BlockDriverState *bs created from bdrv_file_open() Signed-off-by: Nicholas A. Bellinger Reported-by: Chris Krumme Signed-off-by: Kevin Wolf --- block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'block.c') diff --git a/block.c b/block.c index 24c63f6..296de89 100644 --- a/block.c +++ b/block.c @@ -332,8 +332,10 @@ static BlockDriver *find_image_format(const char *filename) return NULL; /* Return the raw BlockDriver * to scsi-generic devices */ - if (bs->sg) + if (bs->sg) { + bdrv_delete(bs); return bdrv_find_format("raw"); + } ret = bdrv_pread(bs, 0, buf, sizeof(buf)); bdrv_delete(bs); -- cgit v1.1