* [Qemu-devel] [PULL 00/29] Block patches
@ 2011-08-03 14:13 Kevin Wolf
2011-08-04 22:07 ` Anthony Liguori
0 siblings, 1 reply; 38+ messages in thread
From: Kevin Wolf @ 2011-08-03 14:13 UTC (permalink / raw)
To: anthony; +Cc: kwolf, qemu-devel
The following changes since commit 927d721777e73339f73719f36eaf400ab641366c:
microblaze: Add missing call to qemu_init_vcpu. (2011-07-31 06:40:13 +0200)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git for-anthony
Aneesh Kumar K.V (1):
coroutine: implement coroutines using gthread
Frediano Ziglio (3):
block: Removed unused function bdrv_write_sync
raw-posix: Typo fix
raw-posix: Always check paio_init result
Hannes Reinecke (5):
scsi-disk: Codingstyle fixes
scsi: Remove references to SET_WINDOW
scsi: Remove REZERO_UNIT emulation
scsi: Sanitize command definitions
scsi-disk: Remove 'drive_kind'
Kevin Wolf (11):
coroutine: introduce coroutines
block: Add bdrv_co_readv/writev
block: Emulate AIO functions with bdrv_co_readv/writev
block: Add bdrv_co_readv/writev emulation
coroutines: Locks
qcow2: Use coroutines
qcow: Use coroutines
async: Remove AsyncContext
coroutines: Use one global bottom half for CoQueue
posix-aio-compat: Allow read after EOF
block: Use bdrv_co_* instead of synchronous versions in coroutines
Markus Armbruster (6):
blockdev: Make eject fail for non-removable drives even with -f
block: Reset device model callbacks on detach
block/raw-win32: Drop disabled code for removable host devices
block: Make BlockDriver method bdrv_set_locked() return void
block: Make BlockDriver method bdrv_eject() return void
block: Don't let locked flag prevent medium load
Serge E. Hallyn (1):
block/vpc.c: Detect too-large vpc file
Stefan Hajnoczi (2):
coroutine: add test-coroutine automated tests
coroutine: add test-coroutine --benchmark-lifecycle
.gitignore | 1 +
Makefile | 3 +-
Makefile.objs | 11 ++
async.c | 98 +---------------
block.c | 308 +++++++++++++++++++++++++++++++++++++++++++------
block.h | 7 +-
block/qcow.c | 180 ++++++++++-------------------
block/qcow2-cluster.c | 26 ++---
block/qcow2.c | 240 ++++++++++++++------------------------
block/qcow2.h | 5 +-
block/qed-table.c | 14 ---
block/qed.c | 4 -
block/raw-posix.c | 39 +++----
block/raw-win32.c | 35 ------
block/raw.c | 7 +-
block/vpc.c | 8 +-
block_int.h | 10 ++-
blockdev.c | 17 +--
configure | 18 +++
coroutine-gthread.c | 131 +++++++++++++++++++++
coroutine-ucontext.c | 230 ++++++++++++++++++++++++++++++++++++
coroutine-win32.c | 92 +++++++++++++++
hw/scsi-bus.c | 74 +++++++-----
hw/scsi-defs.h | 62 ++++++----
hw/scsi-disk.c | 79 ++++++-------
hw/scsi-generic.c | 2 +-
linux-aio.c | 43 +------
posix-aio-compat.c | 30 +++--
qemu-common.h | 4 -
qemu-coroutine-int.h | 49 ++++++++
qemu-coroutine-lock.c | 117 +++++++++++++++++++
qemu-coroutine.c | 75 ++++++++++++
qemu-coroutine.h | 159 +++++++++++++++++++++++++
test-coroutine.c | 192 ++++++++++++++++++++++++++++++
trace-events | 16 +++
35 files changed, 1719 insertions(+), 667 deletions(-)
create mode 100644 coroutine-gthread.c
create mode 100644 coroutine-ucontext.c
create mode 100644 coroutine-win32.c
create mode 100644 qemu-coroutine-int.h
create mode 100644 qemu-coroutine-lock.c
create mode 100644 qemu-coroutine.c
create mode 100644 qemu-coroutine.h
create mode 100644 test-coroutine.c
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [PULL 00/29] Block patches
2011-08-03 14:13 Kevin Wolf
@ 2011-08-04 22:07 ` Anthony Liguori
0 siblings, 0 replies; 38+ messages in thread
From: Anthony Liguori @ 2011-08-04 22:07 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On 08/03/2011 09:13 AM, Kevin Wolf wrote:
> The following changes since commit 927d721777e73339f73719f36eaf400ab641366c:
>
> microblaze: Add missing call to qemu_init_vcpu. (2011-07-31 06:40:13 +0200)
>
> are available in the git repository at:
> git://repo.or.cz/qemu/kevin.git for-anthony
Pulled. Thanks.
Regards,
Anthony Liguori
>
> Aneesh Kumar K.V (1):
> coroutine: implement coroutines using gthread
>
> Frediano Ziglio (3):
> block: Removed unused function bdrv_write_sync
> raw-posix: Typo fix
> raw-posix: Always check paio_init result
>
> Hannes Reinecke (5):
> scsi-disk: Codingstyle fixes
> scsi: Remove references to SET_WINDOW
> scsi: Remove REZERO_UNIT emulation
> scsi: Sanitize command definitions
> scsi-disk: Remove 'drive_kind'
>
> Kevin Wolf (11):
> coroutine: introduce coroutines
> block: Add bdrv_co_readv/writev
> block: Emulate AIO functions with bdrv_co_readv/writev
> block: Add bdrv_co_readv/writev emulation
> coroutines: Locks
> qcow2: Use coroutines
> qcow: Use coroutines
> async: Remove AsyncContext
> coroutines: Use one global bottom half for CoQueue
> posix-aio-compat: Allow read after EOF
> block: Use bdrv_co_* instead of synchronous versions in coroutines
>
> Markus Armbruster (6):
> blockdev: Make eject fail for non-removable drives even with -f
> block: Reset device model callbacks on detach
> block/raw-win32: Drop disabled code for removable host devices
> block: Make BlockDriver method bdrv_set_locked() return void
> block: Make BlockDriver method bdrv_eject() return void
> block: Don't let locked flag prevent medium load
>
> Serge E. Hallyn (1):
> block/vpc.c: Detect too-large vpc file
>
> Stefan Hajnoczi (2):
> coroutine: add test-coroutine automated tests
> coroutine: add test-coroutine --benchmark-lifecycle
>
> .gitignore | 1 +
> Makefile | 3 +-
> Makefile.objs | 11 ++
> async.c | 98 +---------------
> block.c | 308 +++++++++++++++++++++++++++++++++++++++++++------
> block.h | 7 +-
> block/qcow.c | 180 ++++++++++-------------------
> block/qcow2-cluster.c | 26 ++---
> block/qcow2.c | 240 ++++++++++++++------------------------
> block/qcow2.h | 5 +-
> block/qed-table.c | 14 ---
> block/qed.c | 4 -
> block/raw-posix.c | 39 +++----
> block/raw-win32.c | 35 ------
> block/raw.c | 7 +-
> block/vpc.c | 8 +-
> block_int.h | 10 ++-
> blockdev.c | 17 +--
> configure | 18 +++
> coroutine-gthread.c | 131 +++++++++++++++++++++
> coroutine-ucontext.c | 230 ++++++++++++++++++++++++++++++++++++
> coroutine-win32.c | 92 +++++++++++++++
> hw/scsi-bus.c | 74 +++++++-----
> hw/scsi-defs.h | 62 ++++++----
> hw/scsi-disk.c | 79 ++++++-------
> hw/scsi-generic.c | 2 +-
> linux-aio.c | 43 +------
> posix-aio-compat.c | 30 +++--
> qemu-common.h | 4 -
> qemu-coroutine-int.h | 49 ++++++++
> qemu-coroutine-lock.c | 117 +++++++++++++++++++
> qemu-coroutine.c | 75 ++++++++++++
> qemu-coroutine.h | 159 +++++++++++++++++++++++++
> test-coroutine.c | 192 ++++++++++++++++++++++++++++++
> trace-events | 16 +++
> 35 files changed, 1719 insertions(+), 667 deletions(-)
> create mode 100644 coroutine-gthread.c
> create mode 100644 coroutine-ucontext.c
> create mode 100644 coroutine-win32.c
> create mode 100644 qemu-coroutine-int.h
> create mode 100644 qemu-coroutine-lock.c
> create mode 100644 qemu-coroutine.c
> create mode 100644 qemu-coroutine.h
> create mode 100644 test-coroutine.c
>
>
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 00/29] Block patches
@ 2014-08-22 14:51 Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 01/29] block: Use g_new() & friends where that makes obvious sense Kevin Wolf
` (30 more replies)
0 siblings, 31 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
The following changes since commit 302fa283789a2f9b1199c327047cfad2258a23a2:
Revert "memory: Use canonical path component as the name" (2014-08-19 20:05:46 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to bd39e6ed0b88a1473c652c97e731a156cccf16e2:
qemu-img: Allow cache mode specification for amend (2014-08-22 14:54:48 +0200)
----------------------------------------------------------------
Block patches
----------------------------------------------------------------
Fam Zheng (1):
blkdebug: Delete BH in bdrv_aio_cancel
Kevin Wolf (1):
qemu-iotests: Fix 028 reference output for qed
Maria Kustova (2):
runner: Add an argument for test duration
runner: Kill a program under test by time-out
Markus Armbruster (5):
block: Use g_new() & friends where that makes obvious sense
block: Use g_new() & friends to avoid multiplying sizes
qemu-io-cmds: g_renew() can't fail, bury dead error handling
block: Drop some superfluous casts from void *
vmdk: Use bdrv_nb_sectors() where sectors, not bytes are wanted
Max Reitz (12):
qcow2: Constant cache size in bytes
qcow2: Use g_try_new0() for cache array
qcow2: Add runtime options for cache sizes
iotests: Add test for qcow2's cache options
block: Add bdrv_refresh_filename()
blkdebug: Implement bdrv_refresh_filename()
blkverify: Implement bdrv_refresh_filename()
nbd: Implement bdrv_refresh_filename()
quorum: Implement bdrv_refresh_filename()
iotests: Add test for image filename construction
qemu-img: Allow source cache mode specification
qemu-img: Allow cache mode specification for amend
Michael Tokarev (1):
block/vvfat.c: remove debugging code to reinit stderr if NULL
Ming Lei (1):
test-coroutine: test cost introduced by coroutine
Peter Lieven (1):
block/iscsi: fix memory corruption on iscsi resize
Stefan Hajnoczi (4):
block: acquire AioContext in qmp_block_resize()
virtio-blk: allow block_resize with dataplane
raw-posix: fix O_DIRECT short reads
qemu-iotests: add test case 101 for short file I/O
zhanghailiang (1):
virtio-blk: fix reference a pointer which might be freed
block-migration.c | 6 +-
block.c | 149 +++++++++++++++++++++++++++++++++++++--
block/archipelago.c | 6 +-
block/blkdebug.c | 101 ++++++++++++++++++++++++++
block/blkverify.c | 29 ++++++++
block/bochs.c | 2 +-
block/gluster.c | 8 +--
block/iscsi.c | 5 +-
block/nbd.c | 36 ++++++++++
block/nfs.c | 2 +-
block/parallels.c | 2 +-
block/qcow.c | 2 +-
block/qcow2-cache.c | 13 ++--
block/qcow2-cluster.c | 2 +-
block/qcow2-refcount.c | 8 +--
block/qcow2-snapshot.c | 8 +--
block/qcow2.c | 120 ++++++++++++++++++++++++++++---
block/qcow2.h | 13 +++-
block/qed-check.c | 3 +-
block/quorum.c | 39 ++++++++++
block/raw-posix.c | 11 ++-
block/rbd.c | 6 +-
block/sheepdog.c | 6 +-
block/vdi.c | 2 +-
block/vhdx-log.c | 2 +-
block/vhdx.c | 4 +-
block/vmdk.c | 18 +++--
block/vvfat.c | 19 ++---
blockdev-nbd.c | 2 +-
blockdev.c | 15 ++--
hw/block/dataplane/virtio-blk.c | 1 +
hw/block/nvme.c | 8 +--
hw/block/virtio-blk.c | 3 +-
hw/ide/ahci.c | 2 +-
hw/ide/microdrive.c | 2 +-
include/block/block.h | 1 +
include/block/block_int.h | 6 ++
qemu-img-cmds.hx | 20 +++---
qemu-img.c | 97 +++++++++++++++++++------
qemu-img.texi | 16 +++--
qemu-io-cmds.c | 21 ++----
qemu-io.c | 2 +-
tests/image-fuzzer/runner.py | 50 ++++++++++---
tests/qemu-iotests/028 | 1 +
tests/qemu-iotests/028.out | 3 +-
tests/qemu-iotests/099 | 116 ++++++++++++++++++++++++++++++
tests/qemu-iotests/099.out | 20 ++++++
tests/qemu-iotests/101 | 58 +++++++++++++++
tests/qemu-iotests/101.out | 10 +++
tests/qemu-iotests/103 | 99 ++++++++++++++++++++++++++
tests/qemu-iotests/103.out | 29 ++++++++
tests/qemu-iotests/common.filter | 22 ++++++
tests/qemu-iotests/common.rc | 19 +----
tests/qemu-iotests/group | 3 +
tests/test-coroutine.c | 30 ++++++++
55 files changed, 1103 insertions(+), 175 deletions(-)
create mode 100755 tests/qemu-iotests/099
create mode 100644 tests/qemu-iotests/099.out
create mode 100755 tests/qemu-iotests/101
create mode 100644 tests/qemu-iotests/101.out
create mode 100755 tests/qemu-iotests/103
create mode 100644 tests/qemu-iotests/103.out
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 01/29] block: Use g_new() & friends where that makes obvious sense
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 02/29] block: Use g_new() & friends to avoid multiplying sizes Kevin Wolf
` (29 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer,
for two reasons. One, it catches multiplication overflowing size_t.
Two, it returns T * rather than void *, which lets the compiler catch
more type errors.
Patch created with Coccinelle, with two manual changes on top:
* Add const to bdrv_iterate_format() to keep the types straight
* Convert the allocation in bdrv_drop_intermediate(), which Coccinelle
inexplicably misses
Coccinelle semantic patch:
@@
type T;
@@
-g_malloc(sizeof(T))
+g_new(T, 1)
@@
type T;
@@
-g_try_malloc(sizeof(T))
+g_try_new(T, 1)
@@
type T;
@@
-g_malloc0(sizeof(T))
+g_new0(T, 1)
@@
type T;
@@
-g_try_malloc0(sizeof(T))
+g_try_new0(T, 1)
@@
type T;
expression n;
@@
-g_malloc(sizeof(T) * (n))
+g_new(T, n)
@@
type T;
expression n;
@@
-g_try_malloc(sizeof(T) * (n))
+g_try_new(T, n)
@@
type T;
expression n;
@@
-g_malloc0(sizeof(T) * (n))
+g_new0(T, n)
@@
type T;
expression n;
@@
-g_try_malloc0(sizeof(T) * (n))
+g_try_new0(T, n)
@@
type T;
expression p, n;
@@
-g_realloc(p, sizeof(T) * (n))
+g_renew(T, p, n)
@@
type T;
expression p, n;
@@
-g_try_realloc(p, sizeof(T) * (n))
+g_try_renew(T, p, n)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block-migration.c | 6 +++---
block.c | 14 +++++++-------
block/archipelago.c | 6 +++---
block/gluster.c | 8 ++++----
block/iscsi.c | 2 +-
block/nfs.c | 2 +-
block/qcow.c | 2 +-
block/qcow2-cluster.c | 2 +-
block/qcow2-refcount.c | 8 ++++----
block/qcow2-snapshot.c | 8 ++++----
block/raw-posix.c | 2 +-
block/rbd.c | 4 ++--
block/sheepdog.c | 4 ++--
block/vdi.c | 2 +-
block/vhdx.c | 4 ++--
block/vmdk.c | 7 +++----
block/vvfat.c | 2 +-
blockdev-nbd.c | 2 +-
blockdev.c | 2 +-
hw/ide/ahci.c | 2 +-
qemu-io-cmds.c | 2 +-
qemu-io.c | 2 +-
22 files changed, 46 insertions(+), 47 deletions(-)
diff --git a/block-migration.c b/block-migration.c
index ba3ed36..3ad31a2 100644
--- a/block-migration.c
+++ b/block-migration.c
@@ -283,7 +283,7 @@ static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds)
nr_sectors = total_sectors - cur_sector;
}
- blk = g_malloc(sizeof(BlkMigBlock));
+ blk = g_new(BlkMigBlock, 1);
blk->buf = g_malloc(BLOCK_SIZE);
blk->bmds = bmds;
blk->sector = cur_sector;
@@ -354,7 +354,7 @@ static void init_blk_migration_it(void *opaque, BlockDriverState *bs)
return;
}
- bmds = g_malloc0(sizeof(BlkMigDevState));
+ bmds = g_new0(BlkMigDevState, 1);
bmds->bs = bs;
bmds->bulk_completed = 0;
bmds->total_sectors = sectors;
@@ -465,7 +465,7 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDevState *bmds,
} else {
nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK;
}
- blk = g_malloc(sizeof(BlkMigBlock));
+ blk = g_new(BlkMigBlock, 1);
blk->buf = g_malloc(BLOCK_SIZE);
blk->bmds = bmds;
blk->sector = sector;
diff --git a/block.c b/block.c
index 6fa0201..712f5db 100644
--- a/block.c
+++ b/block.c
@@ -351,7 +351,7 @@ BlockDriverState *bdrv_new(const char *device_name, Error **errp)
return NULL;
}
- bs = g_malloc0(sizeof(BlockDriverState));
+ bs = g_new0(BlockDriverState, 1);
QLIST_INIT(&bs->dirty_bitmaps);
pstrcpy(bs->device_name, sizeof(bs->device_name), device_name);
if (device_name[0] != '\0') {
@@ -2628,7 +2628,7 @@ int bdrv_drop_intermediate(BlockDriverState *active, BlockDriverState *top,
* into our deletion queue, until we hit the 'base'
*/
while (intermediate) {
- intermediate_state = g_malloc0(sizeof(BlkIntermediateStates));
+ intermediate_state = g_new0(BlkIntermediateStates, 1);
intermediate_state->bs = intermediate;
QSIMPLEQ_INSERT_TAIL(&states_to_delete, intermediate_state, entry);
@@ -3755,7 +3755,7 @@ void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
}
if (!found) {
- formats = g_realloc(formats, (count + 1) * sizeof(char *));
+ formats = g_renew(const char *, formats, count + 1);
formats[count++] = drv->format_name;
it(opaque, drv->format_name);
}
@@ -5330,7 +5330,7 @@ BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, int granularity,
errno = -bitmap_size;
return NULL;
}
- bitmap = g_malloc0(sizeof(BdrvDirtyBitmap));
+ bitmap = g_new0(BdrvDirtyBitmap, 1);
bitmap->bitmap = hbitmap_alloc(bitmap_size, ffs(granularity) - 1);
QLIST_INSERT_HEAD(&bs->dirty_bitmaps, bitmap, list);
return bitmap;
@@ -5356,8 +5356,8 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)
BlockDirtyInfoList **plist = &list;
QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) {
- BlockDirtyInfo *info = g_malloc0(sizeof(BlockDirtyInfo));
- BlockDirtyInfoList *entry = g_malloc0(sizeof(BlockDirtyInfoList));
+ BlockDirtyInfo *info = g_new0(BlockDirtyInfo, 1);
+ BlockDirtyInfoList *entry = g_new0(BlockDirtyInfoList, 1);
info->count = bdrv_get_dirty_count(bs, bm);
info->granularity =
((int64_t) BDRV_SECTOR_SIZE << hbitmap_granularity(bm->bitmap));
@@ -5451,7 +5451,7 @@ void bdrv_op_block(BlockDriverState *bs, BlockOpType op, Error *reason)
BdrvOpBlocker *blocker;
assert((int) op >= 0 && op < BLOCK_OP_TYPE_MAX);
- blocker = g_malloc0(sizeof(BdrvOpBlocker));
+ blocker = g_new0(BdrvOpBlocker, 1);
blocker->reason = reason;
QLIST_INSERT_HEAD(&bs->op_blockers[op], blocker, list);
}
diff --git a/block/archipelago.c b/block/archipelago.c
index 6629d03..34f72dc 100644
--- a/block/archipelago.c
+++ b/block/archipelago.c
@@ -750,7 +750,7 @@ static int archipelago_submit_request(BDRVArchipelagoState *s,
char *target;
void *data = NULL;
struct xseg_request *req;
- AIORequestData *reqdata = g_malloc(sizeof(AIORequestData));
+ AIORequestData *reqdata = g_new(AIORequestData, 1);
targetlen = strlen(s->volname);
req = xseg_get_request(s->xseg, s->srcport, s->vportno, X_ALLOC);
@@ -827,7 +827,7 @@ static int archipelago_aio_segmented_rw(BDRVArchipelagoState *s,
int i, ret, segments_nr, last_segment_size;
ArchipelagoSegmentedRequest *segreq;
- segreq = g_malloc(sizeof(ArchipelagoSegmentedRequest));
+ segreq = g_new(ArchipelagoSegmentedRequest, 1);
if (op == ARCHIP_OP_FLUSH) {
segments_nr = 1;
@@ -960,7 +960,7 @@ static int64_t archipelago_volume_info(BDRVArchipelagoState *s)
int ret, targetlen;
struct xseg_request *req;
struct xseg_reply_info *xinfo;
- AIORequestData *reqdata = g_malloc(sizeof(AIORequestData));
+ AIORequestData *reqdata = g_new(AIORequestData, 1);
const char *volname = s->volname;
targetlen = strlen(volname);
diff --git a/block/gluster.c b/block/gluster.c
index 9274dea..1912cf9 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -291,7 +291,7 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options,
BDRVGlusterState *s = bs->opaque;
int open_flags = 0;
int ret = 0;
- GlusterConf *gconf = g_malloc0(sizeof(GlusterConf));
+ GlusterConf *gconf = g_new0(GlusterConf, 1);
QemuOpts *opts;
Error *local_err = NULL;
const char *filename;
@@ -351,12 +351,12 @@ static int qemu_gluster_reopen_prepare(BDRVReopenState *state,
assert(state != NULL);
assert(state->bs != NULL);
- state->opaque = g_malloc0(sizeof(BDRVGlusterReopenState));
+ state->opaque = g_new0(BDRVGlusterReopenState, 1);
reop_s = state->opaque;
qemu_gluster_parse_flags(state->flags, &open_flags);
- gconf = g_malloc0(sizeof(GlusterConf));
+ gconf = g_new0(GlusterConf, 1);
reop_s->glfs = qemu_gluster_init(gconf, state->bs->filename, errp);
if (reop_s->glfs == NULL) {
@@ -486,7 +486,7 @@ static int qemu_gluster_create(const char *filename,
int prealloc = 0;
int64_t total_size = 0;
char *tmp = NULL;
- GlusterConf *gconf = g_malloc0(sizeof(GlusterConf));
+ GlusterConf *gconf = g_new0(GlusterConf, 1);
glfs = qemu_gluster_init(gconf, filename, errp);
if (!glfs) {
diff --git a/block/iscsi.c b/block/iscsi.c
index 2c9cfc1..cdd19c2 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1532,7 +1532,7 @@ static int iscsi_create(const char *filename, QemuOpts *opts, Error **errp)
/* Read out options */
total_size =
qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_SIZE;
- bs->opaque = g_malloc0(sizeof(struct IscsiLun));
+ bs->opaque = g_new0(struct IscsiLun, 1);
iscsilun = bs->opaque;
bs_options = qdict_new();
diff --git a/block/nfs.c b/block/nfs.c
index fe46c33..93d87f3 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -409,7 +409,7 @@ static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp)
{
int ret = 0;
int64_t total_size = 0;
- NFSClient *client = g_malloc0(sizeof(NFSClient));
+ NFSClient *client = g_new0(NFSClient, 1);
client->aio_context = qemu_get_aio_context();
diff --git a/block/qcow.c b/block/qcow.c
index 67332f0..67c237f 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -182,7 +182,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
}
s->l1_table_offset = header.l1_table_offset;
- s->l1_table = g_try_malloc(s->l1_size * sizeof(uint64_t));
+ s->l1_table = g_try_new(uint64_t, s->l1_size);
if (s->l1_table == NULL) {
error_setg(errp, "Could not allocate memory for L1 table");
ret = -ENOMEM;
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 5b36018..735f687 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -711,7 +711,7 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m)
trace_qcow2_cluster_link_l2(qemu_coroutine_self(), m->nb_clusters);
assert(m->nb_clusters > 0);
- old_cluster = g_try_malloc(m->nb_clusters * sizeof(uint64_t));
+ old_cluster = g_try_new(uint64_t, m->nb_clusters);
if (old_cluster == NULL) {
ret = -ENOMEM;
goto err;
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 3b77470..43665b8 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -350,7 +350,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
uint64_t meta_offset = (blocks_used * refcount_block_clusters) *
s->cluster_size;
uint64_t table_offset = meta_offset + blocks_clusters * s->cluster_size;
- uint64_t *new_table = g_try_malloc0(table_size * sizeof(uint64_t));
+ uint64_t *new_table = g_try_new0(uint64_t, table_size);
uint16_t *new_blocks = g_try_malloc0(blocks_clusters * s->cluster_size);
assert(table_size > 0 && blocks_clusters > 0);
@@ -1524,7 +1524,7 @@ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
return -EFBIG;
}
- refcount_table = g_try_malloc0(nb_clusters * sizeof(uint16_t));
+ refcount_table = g_try_new0(uint16_t, nb_clusters);
if (nb_clusters && refcount_table == NULL) {
res->check_errors++;
return -ENOMEM;
@@ -1605,8 +1605,8 @@ int qcow2_check_refcounts(BlockDriverState *bs, BdrvCheckResult *res,
/* increase refcount_table size if necessary */
int old_nb_clusters = nb_clusters;
nb_clusters = (new_offset >> s->cluster_bits) + 1;
- refcount_table = g_realloc(refcount_table,
- nb_clusters * sizeof(uint16_t));
+ refcount_table = g_renew(uint16_t, refcount_table,
+ nb_clusters);
memset(&refcount_table[old_nb_clusters], 0, (nb_clusters
- old_nb_clusters) * sizeof(uint16_t));
}
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index f67b472..f52d7fd 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -58,7 +58,7 @@ int qcow2_read_snapshots(BlockDriverState *bs)
}
offset = s->snapshots_offset;
- s->snapshots = g_malloc0(s->nb_snapshots * sizeof(QCowSnapshot));
+ s->snapshots = g_new0(QCowSnapshot, s->nb_snapshots);
for(i = 0; i < s->nb_snapshots; i++) {
/* Read statically sized part of the snapshot header */
@@ -381,7 +381,7 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
sn->l1_table_offset = l1_table_offset;
sn->l1_size = s->l1_size;
- l1_table = g_try_malloc(s->l1_size * sizeof(uint64_t));
+ l1_table = g_try_new(uint64_t, s->l1_size);
if (s->l1_size && l1_table == NULL) {
ret = -ENOMEM;
goto fail;
@@ -417,7 +417,7 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
}
/* Append the new snapshot to the snapshot list */
- new_snapshot_list = g_malloc((s->nb_snapshots + 1) * sizeof(QCowSnapshot));
+ new_snapshot_list = g_new(QCowSnapshot, s->nb_snapshots + 1);
if (s->snapshots) {
memcpy(new_snapshot_list, s->snapshots,
s->nb_snapshots * sizeof(QCowSnapshot));
@@ -661,7 +661,7 @@ int qcow2_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
return s->nb_snapshots;
}
- sn_tab = g_malloc0(s->nb_snapshots * sizeof(QEMUSnapshotInfo));
+ sn_tab = g_new0(QEMUSnapshotInfo, s->nb_snapshots);
for(i = 0; i < s->nb_snapshots; i++) {
sn_info = sn_tab + i;
sn = s->snapshots + i;
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 1194eb0..5c745b9 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -517,7 +517,7 @@ static int raw_reopen_prepare(BDRVReopenState *state,
s = state->bs->opaque;
- state->opaque = g_malloc0(sizeof(BDRVRawReopenState));
+ state->opaque = g_new0(BDRVRawReopenState, 1);
raw_s = state->opaque;
#ifdef CONFIG_LINUX_AIO
diff --git a/block/rbd.c b/block/rbd.c
index 4459102..3aaf855 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -652,7 +652,7 @@ static BlockDriverAIOCB *rbd_start_aio(BlockDriverState *bs,
off = sector_num * BDRV_SECTOR_SIZE;
size = nb_sectors * BDRV_SECTOR_SIZE;
- rcb = g_malloc(sizeof(RADOSCB));
+ rcb = g_new(RADOSCB, 1);
rcb->done = 0;
rcb->acb = acb;
rcb->buf = buf;
@@ -873,7 +873,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
goto done;
}
- sn_tab = g_malloc0(snap_count * sizeof(QEMUSnapshotInfo));
+ sn_tab = g_new0(QEMUSnapshotInfo, snap_count);
for (i = 0; i < snap_count; i++) {
const char *snap_name = snaps[i].name;
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 8d9350c..ba1ef43 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1682,7 +1682,7 @@ static int sd_create(const char *filename, QemuOpts *opts,
uint32_t snapid;
bool prealloc = false;
- s = g_malloc0(sizeof(BDRVSheepdogState));
+ s = g_new0(BDRVSheepdogState, 1);
memset(tag, 0, sizeof(tag));
if (strstr(filename, "://")) {
@@ -2273,7 +2273,7 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
uint32_t snapid = 0;
int ret = 0;
- old_s = g_malloc(sizeof(BDRVSheepdogState));
+ old_s = g_new(BDRVSheepdogState, 1);
memcpy(old_s, s, sizeof(BDRVSheepdogState));
diff --git a/block/vdi.c b/block/vdi.c
index adc6aa9..4b10aac 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -292,7 +292,7 @@ static int vdi_check(BlockDriverState *bs, BdrvCheckResult *res,
return -ENOTSUP;
}
- bmap = g_try_malloc(s->header.blocks_in_image * sizeof(uint32_t));
+ bmap = g_try_new(uint32_t, s->header.blocks_in_image);
if (s->header.blocks_in_image && bmap == NULL) {
res->check_errors++;
return -ENOMEM;
diff --git a/block/vhdx.c b/block/vhdx.c
index f666940..87c99fc 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -1381,7 +1381,7 @@ static int vhdx_create_new_headers(BlockDriverState *bs, uint64_t image_size,
int ret = 0;
VHDXHeader *hdr = NULL;
- hdr = g_malloc0(sizeof(VHDXHeader));
+ hdr = g_new0(VHDXHeader, 1);
hdr->signature = VHDX_HEADER_SIGNATURE;
hdr->sequence_number = g_random_int();
@@ -1654,7 +1654,7 @@ static int vhdx_create_new_region_table(BlockDriverState *bs,
/* Populate enough of the BDRVVHDXState to be able to use the
* pre-existing BAT calculation, translation, and update functions */
- s = g_malloc0(sizeof(BDRVVHDXState));
+ s = g_new0(BDRVVHDXState, 1);
s->chunk_ratio = (VHDX_MAX_SECTORS_PER_BLOCK) *
(uint64_t) sector_size / (uint64_t) block_size;
diff --git a/block/vmdk.c b/block/vmdk.c
index 01412a8..f000d2a 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -233,7 +233,7 @@ static void vmdk_free_last_extent(BlockDriverState *bs)
return;
}
s->num_extents--;
- s->extents = g_realloc(s->extents, s->num_extents * sizeof(VmdkExtent));
+ s->extents = g_renew(VmdkExtent, s->extents, s->num_extents);
}
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
@@ -418,8 +418,7 @@ static int vmdk_add_extent(BlockDriverState *bs,
return length;
}
- s->extents = g_realloc(s->extents,
- (s->num_extents + 1) * sizeof(VmdkExtent));
+ s->extents = g_renew(VmdkExtent, s->extents, s->num_extents + 1);
extent = &s->extents[s->num_extents];
s->num_extents++;
@@ -497,7 +496,7 @@ static int vmdk_init_tables(BlockDriverState *bs, VmdkExtent *extent,
}
extent->l2_cache =
- g_malloc(extent->l2_size * L2_CACHE_SIZE * sizeof(uint32_t));
+ g_new(uint32_t, extent->l2_size * L2_CACHE_SIZE);
return 0;
fail_l1b:
g_free(extent->l1_backup_table);
diff --git a/block/vvfat.c b/block/vvfat.c
index 70176b1..f877e85 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2950,7 +2950,7 @@ static int enable_write_target(BDRVVVFATState *s, Error **errp)
bdrv_set_backing_hd(s->bs, bdrv_new("", &error_abort));
s->bs->backing_hd->drv = &vvfat_write_target;
- s->bs->backing_hd->opaque = g_malloc(sizeof(void*));
+ s->bs->backing_hd->opaque = g_new(void *, 1);
*(void**)s->bs->backing_hd->opaque = s;
return 0;
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index b3a2474..06f901e 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -108,7 +108,7 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
nbd_export_set_name(exp, device);
- n = g_malloc0(sizeof(NBDCloseNotifier));
+ n = g_new0(NBDCloseNotifier, 1);
n->n.notify = nbd_close_notifier;
n->exp = exp;
bdrv_add_close_notifier(bs, &n->n);
diff --git a/blockdev.c b/blockdev.c
index 48bd9a3..8acd264 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1094,7 +1094,7 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device,
return NULL;
}
- info = g_malloc0(sizeof(SnapshotInfo));
+ info = g_new0(SnapshotInfo, 1);
info->id = g_strdup(sn.id_str);
info->name = g_strdup(sn.name);
info->date_nsec = sn.date_nsec;
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 932b0d5..0ee713b 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1203,7 +1203,7 @@ void ahci_init(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports)
s->as = as;
s->ports = ports;
- s->dev = g_malloc0(sizeof(AHCIDevice) * ports);
+ s->dev = g_new0(AHCIDevice, ports);
ahci_reg_init(s);
/* XXX BAR size should be 1k, but that breaks, so bump it to 4k for now */
memory_region_init_io(&s->mem, OBJECT(qdev), &ahci_mem_ops, s,
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index c503fc6..3a1e11e 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -114,7 +114,7 @@ static char **breakline(char *input, int *count)
{
int c = 0;
char *p;
- char **rval = g_malloc0(sizeof(char *));
+ char **rval = g_new0(char *, 1);
char **tmp;
while (rval && (p = qemu_strsep(&input, " ")) != NULL) {
diff --git a/qemu-io.c b/qemu-io.c
index b55a550..33c96c4 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -356,7 +356,7 @@ static void command_loop(void)
static void add_user_command(char *optarg)
{
- cmdline = g_realloc(cmdline, ++ncmdline * sizeof(char *));
+ cmdline = g_renew(char *, cmdline, ++ncmdline);
cmdline[ncmdline-1] = optarg;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 02/29] block: Use g_new() & friends to avoid multiplying sizes
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 01/29] block: Use g_new() & friends where that makes obvious sense Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 03/29] qemu-io-cmds: g_renew() can't fail, bury dead error handling Kevin Wolf
` (28 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
g_new(T, n) is safer than g_malloc(sizeof(*v) * n) for two reasons.
One, it catches multiplication overflowing size_t. Two, it returns
T * rather than void *, which lets the compiler catch more type
errors.
Perhaps a conversion to g_malloc_n() would be neater in places, but
that's merely four years old, and we can't use such newfangled stuff.
This commit only touches allocations with size arguments of the form
sizeof(T), plus two that use 4 instead of sizeof(uint32_t). We can
make the others safe by converting to g_malloc_n() when it becomes
available to us in a couple of years.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/bochs.c | 2 +-
block/parallels.c | 2 +-
block/qcow2-cache.c | 2 +-
block/qed-check.c | 3 +--
block/rbd.c | 2 +-
block/sheepdog.c | 2 +-
hw/block/nvme.c | 8 ++++----
qemu-io-cmds.c | 10 +++++-----
8 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/block/bochs.c b/block/bochs.c
index 6674b27..199ac2b 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -131,7 +131,7 @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags,
return -EFBIG;
}
- s->catalog_bitmap = g_try_malloc(s->catalog_size * 4);
+ s->catalog_bitmap = g_try_new(uint32_t, s->catalog_size);
if (s->catalog_size && s->catalog_bitmap == NULL) {
error_setg(errp, "Could not allocate memory for catalog");
return -ENOMEM;
diff --git a/block/parallels.c b/block/parallels.c
index 1774ab8..2a814f3 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -121,7 +121,7 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
ret = -EFBIG;
goto fail;
}
- s->catalog_bitmap = g_try_malloc(s->catalog_size * 4);
+ s->catalog_bitmap = g_try_new(uint32_t, s->catalog_size);
if (s->catalog_size && s->catalog_bitmap == NULL) {
ret = -ENOMEM;
goto fail;
diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
index 5353b44..fe0615a 100644
--- a/block/qcow2-cache.c
+++ b/block/qcow2-cache.c
@@ -50,7 +50,7 @@ Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables)
c = g_malloc0(sizeof(*c));
c->size = num_tables;
- c->entries = g_malloc0(sizeof(*c->entries) * num_tables);
+ c->entries = g_new0(Qcow2CachedTable, num_tables);
for (i = 0; i < c->size; i++) {
c->entries[i].table = qemu_try_blockalign(bs->file, s->cluster_size);
diff --git a/block/qed-check.c b/block/qed-check.c
index 40a882c..36ecd29 100644
--- a/block/qed-check.c
+++ b/block/qed-check.c
@@ -227,8 +227,7 @@ int qed_check(BDRVQEDState *s, BdrvCheckResult *result, bool fix)
};
int ret;
- check.used_clusters = g_try_malloc0(((check.nclusters + 31) / 32) *
- sizeof(check.used_clusters[0]));
+ check.used_clusters = g_try_new0(uint32_t, (check.nclusters + 31) / 32);
if (check.nclusters && check.used_clusters == NULL) {
return -ENOMEM;
}
diff --git a/block/rbd.c b/block/rbd.c
index 3aaf855..ea969e7 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -862,7 +862,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
int max_snaps = RBD_MAX_SNAPS;
do {
- snaps = g_malloc(sizeof(*snaps) * max_snaps);
+ snaps = g_new(rbd_snap_info_t, max_snaps);
snap_count = rbd_snap_list(s->image, snaps, &max_snaps);
if (snap_count <= 0) {
g_free(snaps);
diff --git a/block/sheepdog.c b/block/sheepdog.c
index ba1ef43..12cbd9d 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2357,7 +2357,7 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
goto out;
}
- sn_tab = g_malloc0(nr * sizeof(*sn_tab));
+ sn_tab = g_new0(QEMUSnapshotInfo, nr);
/* calculate a vdi id with hash function */
hval = fnv_64a_buf(s->name, strlen(s->name), FNV1A_64_INIT);
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 6d9a065..04459e5 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -319,7 +319,7 @@ static void nvme_init_sq(NvmeSQueue *sq, NvmeCtrl *n, uint64_t dma_addr,
sq->size = size;
sq->cqid = cqid;
sq->head = sq->tail = 0;
- sq->io_req = g_malloc(sq->size * sizeof(*sq->io_req));
+ sq->io_req = g_new(NvmeRequest, sq->size);
QTAILQ_INIT(&sq->req_list);
QTAILQ_INIT(&sq->out_req_list);
@@ -773,9 +773,9 @@ static int nvme_init(PCIDevice *pci_dev)
n->reg_size = 1 << qemu_fls(0x1004 + 2 * (n->num_queues + 1) * 4);
n->ns_size = bs_size / (uint64_t)n->num_namespaces;
- n->namespaces = g_malloc0(sizeof(*n->namespaces)*n->num_namespaces);
- n->sq = g_malloc0(sizeof(*n->sq)*n->num_queues);
- n->cq = g_malloc0(sizeof(*n->cq)*n->num_queues);
+ n->namespaces = g_new0(NvmeNamespace, n->num_namespaces);
+ n->sq = g_new0(NvmeSQueue *, n->num_queues);
+ n->cq = g_new0(NvmeCQueue *, n->num_queues);
memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n,
"nvme", n->reg_size);
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 3a1e11e..afd8867 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -29,7 +29,7 @@ static int compare_cmdname(const void *a, const void *b)
void qemuio_add_command(const cmdinfo_t *ci)
{
- cmdtab = g_realloc(cmdtab, ++ncmds * sizeof(*cmdtab));
+ cmdtab = g_renew(cmdinfo_t, cmdtab, ++ncmds);
cmdtab[ncmds - 1] = *ci;
qsort(cmdtab, ncmds, sizeof(*cmdtab), compare_cmdname);
}
@@ -122,7 +122,7 @@ static char **breakline(char *input, int *count)
continue;
}
c++;
- tmp = g_realloc(rval, sizeof(*rval) * (c + 1));
+ tmp = g_renew(char *, rval, (c + 1));
if (!tmp) {
g_free(rval);
rval = NULL;
@@ -1264,9 +1264,9 @@ static int multiwrite_f(BlockDriverState *bs, int argc, char **argv)
}
}
- reqs = g_malloc0(nr_reqs * sizeof(*reqs));
- buf = g_malloc0(nr_reqs * sizeof(*buf));
- qiovs = g_malloc(nr_reqs * sizeof(*qiovs));
+ reqs = g_new0(BlockRequest, nr_reqs);
+ buf = g_new0(char *, nr_reqs);
+ qiovs = g_new(QEMUIOVector, nr_reqs);
for (i = 0; i < nr_reqs && optind < argc; i++) {
int j;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 03/29] qemu-io-cmds: g_renew() can't fail, bury dead error handling
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 01/29] block: Use g_new() & friends where that makes obvious sense Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 02/29] block: Use g_new() & friends to avoid multiplying sizes Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 04/29] block: Drop some superfluous casts from void * Kevin Wolf
` (27 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-io-cmds.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index afd8867..b224ede 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -115,22 +115,13 @@ static char **breakline(char *input, int *count)
int c = 0;
char *p;
char **rval = g_new0(char *, 1);
- char **tmp;
while (rval && (p = qemu_strsep(&input, " ")) != NULL) {
if (!*p) {
continue;
}
c++;
- tmp = g_renew(char *, rval, (c + 1));
- if (!tmp) {
- g_free(rval);
- rval = NULL;
- c = 0;
- break;
- } else {
- rval = tmp;
- }
+ rval = g_renew(char *, rval, (c + 1));
rval[c - 1] = p;
rval[c] = NULL;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 04/29] block: Drop some superfluous casts from void *
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (2 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 03/29] qemu-io-cmds: g_renew() can't fail, bury dead error handling Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 05/29] runner: Add an argument for test duration Kevin Wolf
` (26 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
They clutter the code. Unfortunately, I can't figure out how to make
Coccinelle drop all of them, so I have to settle for common special
cases:
@@
type T;
T *pt;
void *pv;
@@
- pt = (T *)pv;
+ pt = pv;
@@
type T;
@@
- (T *)
(\(g_malloc\|g_malloc0\|g_realloc\|g_new\|g_new0\|g_renew\|
g_try_malloc\|g_try_malloc0\|g_try_realloc\|
g_try_new\|g_try_new0\|g_try_renew\)(...))
Topped off with minor manual style cleanups.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vhdx-log.c | 2 +-
block/vvfat.c | 8 ++++----
hw/ide/microdrive.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/block/vhdx-log.c b/block/vhdx-log.c
index eb5c7a0..6547bec 100644
--- a/block/vhdx-log.c
+++ b/block/vhdx-log.c
@@ -923,7 +923,7 @@ static int vhdx_log_write(BlockDriverState *bs, BDRVVHDXState *s,
buffer = qemu_blockalign(bs, total_length);
memcpy(buffer, &new_hdr, sizeof(new_hdr));
- new_desc = (VHDXLogDescriptor *) (buffer + sizeof(new_hdr));
+ new_desc = buffer + sizeof(new_hdr);
data_sector = buffer + (desc_sectors * VHDX_LOG_SECTOR_SIZE);
data_tmp = data;
diff --git a/block/vvfat.c b/block/vvfat.c
index f877e85..e56f766 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -732,7 +732,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
if(first_cluster == 0 && (is_dotdot || is_dot))
continue;
- buffer=(char*)g_malloc(length);
+ buffer = g_malloc(length);
snprintf(buffer,length,"%s/%s",dirname,entry->d_name);
if(stat(buffer,&st)<0) {
@@ -767,7 +767,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
/* create mapping for this file */
if(!is_dot && !is_dotdot && (S_ISDIR(st.st_mode) || st.st_size)) {
- s->current_mapping=(mapping_t*)array_get_next(&(s->mapping));
+ s->current_mapping = array_get_next(&(s->mapping));
s->current_mapping->begin=0;
s->current_mapping->end=st.st_size;
/*
@@ -811,12 +811,12 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
}
/* reget the mapping, since s->mapping was possibly realloc()ed */
- mapping = (mapping_t*)array_get(&(s->mapping), mapping_index);
+ mapping = array_get(&(s->mapping), mapping_index);
first_cluster += (s->directory.next - mapping->info.dir.first_dir_index)
* 0x20 / s->cluster_size;
mapping->end = first_cluster;
- direntry = (direntry_t*)array_get(&(s->directory), mapping->dir_index);
+ direntry = array_get(&(s->directory), mapping->dir_index);
set_begin_of_direntry(direntry, mapping->begin);
return 0;
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
index 2d70ddb..15671b8 100644
--- a/hw/ide/microdrive.c
+++ b/hw/ide/microdrive.c
@@ -567,7 +567,7 @@ PCMCIACardState *dscm1xxxx_init(DriveInfo *dinfo)
}
md->bus.ifs[0].drive_kind = IDE_CFATA;
md->bus.ifs[0].mdata_size = METADATA_SIZE;
- md->bus.ifs[0].mdata_storage = (uint8_t *) g_malloc0(METADATA_SIZE);
+ md->bus.ifs[0].mdata_storage = g_malloc0(METADATA_SIZE);
return PCMCIA_CARD(md);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 05/29] runner: Add an argument for test duration
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (3 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 04/29] block: Drop some superfluous casts from void * Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 06/29] runner: Kill a program under test by time-out Kevin Wolf
` (25 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Maria Kustova <maxa@catit.be>
After the specified duration the runner stops executing new tests, but it
doesn't interrupt running ones.
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Maria Kustova <maria.k@catit.be>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/image-fuzzer/runner.py | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py
index 58079d3..1e38b95 100755
--- a/tests/image-fuzzer/runner.py
+++ b/tests/image-fuzzer/runner.py
@@ -25,6 +25,7 @@ import subprocess
import random
import shutil
from itertools import count
+import time
import getopt
import StringIO
import resource
@@ -269,6 +270,7 @@ if __name__ == '__main__':
Optional arguments:
-h, --help display this help and exit
+ -d, --duration=NUMBER finish tests after NUMBER of seconds
-c, --command=JSON run tests for all commands specified in
the JSON array
-s, --seed=STRING seed for a test image generation,
@@ -325,10 +327,15 @@ if __name__ == '__main__':
finally:
test.finish()
+ def should_continue(duration, start_time):
+ """Return True if a new test can be started and False otherwise."""
+ current_time = int(time.time())
+ return (duration is None) or (current_time - start_time < duration)
+
try:
- opts, args = getopt.gnu_getopt(sys.argv[1:], 'c:hs:kv',
+ opts, args = getopt.gnu_getopt(sys.argv[1:], 'c:hs:kvd:',
['command=', 'help', 'seed=', 'config=',
- 'keep_passed', 'verbose'])
+ 'keep_passed', 'verbose', 'duration='])
except getopt.error, e:
print >>sys.stderr, \
"Error: %s\n\nTry 'runner.py --help' for more information" % e
@@ -339,6 +346,8 @@ if __name__ == '__main__':
log_all = False
seed = None
config = None
+ duration = None
+
for opt, arg in opts:
if opt in ('-h', '--help'):
usage()
@@ -357,6 +366,8 @@ if __name__ == '__main__':
log_all = True
elif opt in ('-s', '--seed'):
seed = arg
+ elif opt in ('-d', '--duration'):
+ duration = int(arg)
elif opt == '--config':
try:
config = json.loads(arg)
@@ -394,9 +405,11 @@ if __name__ == '__main__':
resource.setrlimit(resource.RLIMIT_CORE, (-1, -1))
# If a seed is specified, only one test will be executed.
# Otherwise runner will terminate after a keyboard interruption
- for test_id in count(1):
+ start_time = int(time.time())
+ test_id = count(1)
+ while should_continue(duration, start_time):
try:
- run_test(str(test_id), seed, work_dir, run_log, cleanup,
+ run_test(str(test_id.next()), seed, work_dir, run_log, cleanup,
log_all, command, config)
except (KeyboardInterrupt, SystemExit):
sys.exit(1)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 06/29] runner: Kill a program under test by time-out
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (4 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 05/29] runner: Add an argument for test duration Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 07/29] qcow2: Constant cache size in bytes Kevin Wolf
` (24 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Maria Kustova <maxa@catit.be>
If a program under test get frozen, the test should finish and report about its
failure.
In such cases the runner waits for 10 minutes until the program ends its
execution. After this time-out the program will be terminated and the test will
be marked as failed.
For current limitation of test image size to 10 MB as a maximum an execution of
each command takes about several seconds in general, so 10 minutes is enough to
discriminate freeze, but not drastically increase an overall test duration.
Signed-off-by: Maria Kustova <maria.k@catit.be>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/image-fuzzer/runner.py | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py
index 1e38b95..c903c8a 100755
--- a/tests/image-fuzzer/runner.py
+++ b/tests/image-fuzzer/runner.py
@@ -65,14 +65,35 @@ def run_app(fd, q_args):
"""Start an application with specified arguments and return its exit code
or kill signal depending on the result of execution.
"""
+
+ class Alarm(Exception):
+ """Exception for signal.alarm events."""
+ pass
+
+ def handler(*arg):
+ """Notify that an alarm event occurred."""
+ raise Alarm
+
+ signal.signal(signal.SIGALRM, handler)
+ signal.alarm(600)
+ term_signal = signal.SIGKILL
devnull = open('/dev/null', 'r+')
process = subprocess.Popen(q_args, stdin=devnull,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- out, err = process.communicate()
- fd.write(out)
- fd.write(err)
- return process.returncode
+ try:
+ out, err = process.communicate()
+ signal.alarm(0)
+ fd.write(out)
+ fd.write(err)
+ fd.flush()
+ return process.returncode
+
+ except Alarm:
+ os.kill(process.pid, term_signal)
+ fd.write('The command was terminated by timeout.\n')
+ fd.flush()
+ return -term_signal
class TestException(Exception):
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 07/29] qcow2: Constant cache size in bytes
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (5 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 06/29] runner: Kill a program under test by time-out Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 08/29] qcow2: Use g_try_new0() for cache array Kevin Wolf
` (23 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Specifying the metadata cache sizes in clusters results in less clusters
(and much less bytes) covered for small cluster sizes and vice versa.
Using a constant byte size reduces this difference, and makes it
possible to manually specify the cache size in an easily comprehensible
unit.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2.c | 15 +++++++++++++--
block/qcow2.h | 10 ++++++++--
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 435e0e1..0f1be2e 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -470,6 +470,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
uint64_t l1_vm_state_index;
const char *opt_overlap_check;
int overlap_check_template = 0;
+ uint64_t l2_cache_size, refcount_cache_size;
ret = bdrv_pread(bs->file, 0, &header, sizeof(header));
if (ret < 0) {
@@ -707,8 +708,18 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
}
/* alloc L2 table/refcount block cache */
- s->l2_table_cache = qcow2_cache_create(bs, L2_CACHE_SIZE);
- s->refcount_block_cache = qcow2_cache_create(bs, REFCOUNT_CACHE_SIZE);
+ l2_cache_size = DEFAULT_L2_CACHE_BYTE_SIZE / s->cluster_size;
+ if (l2_cache_size < MIN_L2_CACHE_SIZE) {
+ l2_cache_size = MIN_L2_CACHE_SIZE;
+ }
+
+ refcount_cache_size = l2_cache_size / DEFAULT_L2_REFCOUNT_SIZE_RATIO;
+ if (refcount_cache_size < MIN_REFCOUNT_CACHE_SIZE) {
+ refcount_cache_size = MIN_REFCOUNT_CACHE_SIZE;
+ }
+
+ s->l2_table_cache = qcow2_cache_create(bs, l2_cache_size);
+ s->refcount_block_cache = qcow2_cache_create(bs, refcount_cache_size);
if (s->l2_table_cache == NULL || s->refcount_block_cache == NULL) {
error_setg(errp, "Could not allocate metadata caches");
ret = -ENOMEM;
diff --git a/block/qcow2.h b/block/qcow2.h
index b49424b..671783d 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -64,10 +64,16 @@
#define MIN_CLUSTER_BITS 9
#define MAX_CLUSTER_BITS 21
-#define L2_CACHE_SIZE 16
+#define MIN_L2_CACHE_SIZE 1 /* cluster */
/* Must be at least 4 to cover all cases of refcount table growth */
-#define REFCOUNT_CACHE_SIZE 4
+#define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */
+
+#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */
+
+/* The refblock cache needs only a fourth of the L2 cache size to cover as many
+ * clusters */
+#define DEFAULT_L2_REFCOUNT_SIZE_RATIO 4
#define DEFAULT_CLUSTER_SIZE 65536
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 08/29] qcow2: Use g_try_new0() for cache array
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (6 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 07/29] qcow2: Constant cache size in bytes Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 09/29] qcow2: Add runtime options for cache sizes Kevin Wolf
` (22 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
With a variable cache size, the number given to qcow2_cache_create() may
be huge. Therefore, use g_try_new0().
While at it, use g_new0() instead of g_malloc0() for allocating the
Qcow2Cache object.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2-cache.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
index fe0615a..904f6b1 100644
--- a/block/qcow2-cache.c
+++ b/block/qcow2-cache.c
@@ -48,9 +48,12 @@ Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables)
Qcow2Cache *c;
int i;
- c = g_malloc0(sizeof(*c));
+ c = g_new0(Qcow2Cache, 1);
c->size = num_tables;
- c->entries = g_new0(Qcow2CachedTable, num_tables);
+ c->entries = g_try_new0(Qcow2CachedTable, num_tables);
+ if (!c->entries) {
+ goto fail;
+ }
for (i = 0; i < c->size; i++) {
c->entries[i].table = qemu_try_blockalign(bs->file, s->cluster_size);
@@ -62,8 +65,10 @@ Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables)
return c;
fail:
- for (i = 0; i < c->size; i++) {
- qemu_vfree(c->entries[i].table);
+ if (c->entries) {
+ for (i = 0; i < c->size; i++) {
+ qemu_vfree(c->entries[i].table);
+ }
}
g_free(c->entries);
g_free(c);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 09/29] qcow2: Add runtime options for cache sizes
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (7 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 08/29] qcow2: Use g_try_new0() for cache array Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 10/29] iotests: Add test for qcow2's cache options Kevin Wolf
` (21 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Add options for specifying the size of the metadata caches. This can
either be done directly for each cache (if only one is given, the other
will be derived according to a default ratio) or combined for both.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
block/qcow2.h | 3 ++
2 files changed, 103 insertions(+), 11 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 0f1be2e..f9e045f 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -442,6 +442,22 @@ static QemuOptsList qcow2_runtime_opts = {
.type = QEMU_OPT_BOOL,
.help = "Check for unintended writes into an inactive L2 table",
},
+ {
+ .name = QCOW2_OPT_CACHE_SIZE,
+ .type = QEMU_OPT_SIZE,
+ .help = "Maximum combined metadata (L2 tables and refcount blocks) "
+ "cache size",
+ },
+ {
+ .name = QCOW2_OPT_L2_CACHE_SIZE,
+ .type = QEMU_OPT_SIZE,
+ .help = "Maximum L2 table cache size",
+ },
+ {
+ .name = QCOW2_OPT_REFCOUNT_CACHE_SIZE,
+ .type = QEMU_OPT_SIZE,
+ .help = "Maximum refcount block cache size",
+ },
{ /* end of list */ }
},
};
@@ -457,6 +473,61 @@ static const char *overlap_bool_option_names[QCOW2_OL_MAX_BITNR] = {
[QCOW2_OL_INACTIVE_L2_BITNR] = QCOW2_OPT_OVERLAP_INACTIVE_L2,
};
+static void read_cache_sizes(QemuOpts *opts, uint64_t *l2_cache_size,
+ uint64_t *refcount_cache_size, Error **errp)
+{
+ uint64_t combined_cache_size;
+ bool l2_cache_size_set, refcount_cache_size_set, combined_cache_size_set;
+
+ combined_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_CACHE_SIZE);
+ l2_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_L2_CACHE_SIZE);
+ refcount_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_REFCOUNT_CACHE_SIZE);
+
+ combined_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_CACHE_SIZE, 0);
+ *l2_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_L2_CACHE_SIZE, 0);
+ *refcount_cache_size = qemu_opt_get_size(opts,
+ QCOW2_OPT_REFCOUNT_CACHE_SIZE, 0);
+
+ if (combined_cache_size_set) {
+ if (l2_cache_size_set && refcount_cache_size_set) {
+ error_setg(errp, QCOW2_OPT_CACHE_SIZE ", " QCOW2_OPT_L2_CACHE_SIZE
+ " and " QCOW2_OPT_REFCOUNT_CACHE_SIZE " may not be set "
+ "the same time");
+ return;
+ } else if (*l2_cache_size > combined_cache_size) {
+ error_setg(errp, QCOW2_OPT_L2_CACHE_SIZE " may not exceed "
+ QCOW2_OPT_CACHE_SIZE);
+ return;
+ } else if (*refcount_cache_size > combined_cache_size) {
+ error_setg(errp, QCOW2_OPT_REFCOUNT_CACHE_SIZE " may not exceed "
+ QCOW2_OPT_CACHE_SIZE);
+ return;
+ }
+
+ if (l2_cache_size_set) {
+ *refcount_cache_size = combined_cache_size - *l2_cache_size;
+ } else if (refcount_cache_size_set) {
+ *l2_cache_size = combined_cache_size - *refcount_cache_size;
+ } else {
+ *refcount_cache_size = combined_cache_size
+ / (DEFAULT_L2_REFCOUNT_SIZE_RATIO + 1);
+ *l2_cache_size = combined_cache_size - *refcount_cache_size;
+ }
+ } else {
+ if (!l2_cache_size_set && !refcount_cache_size_set) {
+ *l2_cache_size = DEFAULT_L2_CACHE_BYTE_SIZE;
+ *refcount_cache_size = *l2_cache_size
+ / DEFAULT_L2_REFCOUNT_SIZE_RATIO;
+ } else if (!l2_cache_size_set) {
+ *l2_cache_size = *refcount_cache_size
+ * DEFAULT_L2_REFCOUNT_SIZE_RATIO;
+ } else if (!refcount_cache_size_set) {
+ *refcount_cache_size = *l2_cache_size
+ / DEFAULT_L2_REFCOUNT_SIZE_RATIO;
+ }
+ }
+}
+
static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
@@ -707,17 +778,43 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
}
}
- /* alloc L2 table/refcount block cache */
- l2_cache_size = DEFAULT_L2_CACHE_BYTE_SIZE / s->cluster_size;
+ /* get L2 table/refcount block cache size from command line options */
+ opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort);
+ qemu_opts_absorb_qdict(opts, options, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ ret = -EINVAL;
+ goto fail;
+ }
+
+ read_cache_sizes(opts, &l2_cache_size, &refcount_cache_size, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ ret = -EINVAL;
+ goto fail;
+ }
+
+ l2_cache_size /= s->cluster_size;
if (l2_cache_size < MIN_L2_CACHE_SIZE) {
l2_cache_size = MIN_L2_CACHE_SIZE;
}
+ if (l2_cache_size > INT_MAX) {
+ error_setg(errp, "L2 cache size too big");
+ ret = -EINVAL;
+ goto fail;
+ }
- refcount_cache_size = l2_cache_size / DEFAULT_L2_REFCOUNT_SIZE_RATIO;
+ refcount_cache_size /= s->cluster_size;
if (refcount_cache_size < MIN_REFCOUNT_CACHE_SIZE) {
refcount_cache_size = MIN_REFCOUNT_CACHE_SIZE;
}
+ if (refcount_cache_size > INT_MAX) {
+ error_setg(errp, "Refcount cache size too big");
+ ret = -EINVAL;
+ goto fail;
+ }
+ /* alloc L2 table/refcount block cache */
s->l2_table_cache = qcow2_cache_create(bs, l2_cache_size);
s->refcount_block_cache = qcow2_cache_create(bs, refcount_cache_size);
if (s->l2_table_cache == NULL || s->refcount_block_cache == NULL) {
@@ -809,14 +906,6 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
}
/* Enable lazy_refcounts according to image and command line options */
- opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort);
- qemu_opts_absorb_qdict(opts, options, &local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- ret = -EINVAL;
- goto fail;
- }
-
s->use_lazy_refcounts = qemu_opt_get_bool(opts, QCOW2_OPT_LAZY_REFCOUNTS,
(s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS));
diff --git a/block/qcow2.h b/block/qcow2.h
index 671783d..6aeb7ea 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -91,6 +91,9 @@
#define QCOW2_OPT_OVERLAP_SNAPSHOT_TABLE "overlap-check.snapshot-table"
#define QCOW2_OPT_OVERLAP_INACTIVE_L1 "overlap-check.inactive-l1"
#define QCOW2_OPT_OVERLAP_INACTIVE_L2 "overlap-check.inactive-l2"
+#define QCOW2_OPT_CACHE_SIZE "cache-size"
+#define QCOW2_OPT_L2_CACHE_SIZE "l2-cache-size"
+#define QCOW2_OPT_REFCOUNT_CACHE_SIZE "refcount-cache-size"
typedef struct QCowHeader {
uint32_t magic;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 10/29] iotests: Add test for qcow2's cache options
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (8 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 09/29] qcow2: Add runtime options for cache sizes Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 11/29] test-coroutine: test cost introduced by coroutine Kevin Wolf
` (20 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Add a test which tests various combinations of qcow2's cache options
(some of which are valid, some of which are not).
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/qemu-iotests/103 | 99 ++++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/103.out | 29 ++++++++++++++
tests/qemu-iotests/group | 1 +
3 files changed, 129 insertions(+)
create mode 100755 tests/qemu-iotests/103
create mode 100644 tests/qemu-iotests/103.out
diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103
new file mode 100755
index 0000000..0f1dc9f
--- /dev/null
+++ b/tests/qemu-iotests/103
@@ -0,0 +1,99 @@
+#!/bin/bash
+#
+# Test case for qcow2 metadata cache size specification
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=mreitz@redhat.com
+
+seq=$(basename $0)
+echo "QA output created by $seq"
+
+here=$PWD
+tmp=/tmp/$$
+status=1 # failure is the default!
+
+_cleanup()
+{
+ _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fmt qcow2
+_supported_proto file
+_supported_os Linux
+
+IMG_SIZE=64K
+
+_make_test_img $IMG_SIZE
+$QEMU_IO -c 'write -P 42 0 64k' "$TEST_IMG" | _filter_qemu_io
+
+echo
+echo '=== Testing invalid option combinations ==='
+echo
+
+# all sizes set at the same time
+$QEMU_IO -c "open -o cache-size=1.25M,l2-cache-size=1M,refcount-cache-size=0.25M $TEST_IMG" \
+ 2>&1 | _filter_testdir | _filter_imgfmt
+# l2-cache-size may not exceed cache-size
+$QEMU_IO -c "open -o cache-size=1M,l2-cache-size=2M $TEST_IMG" 2>&1 \
+ | _filter_testdir | _filter_imgfmt
+# refcount-cache-size may not exceed cache-size
+$QEMU_IO -c "open -o cache-size=1M,refcount-cache-size=2M $TEST_IMG" 2>&1 \
+ | _filter_testdir | _filter_imgfmt
+# 0 should be a valid size (e.g. for enforcing the minimum), so this should not
+# work
+$QEMU_IO -c "open -o cache-size=0,l2-cache-size=0,refcount-cache-size=0 $TEST_IMG" \
+ 2>&1 | _filter_testdir | _filter_imgfmt
+
+echo
+echo '=== Testing valid option combinations ==='
+echo
+
+# There should be a reasonable and working minimum
+$QEMU_IO -c "open -o cache-size=0 $TEST_IMG" -c 'read -P 42 0 64k' \
+ | _filter_qemu_io
+$QEMU_IO -c "open -o l2-cache-size=0 $TEST_IMG" -c 'read -P 42 0 64k' \
+ | _filter_qemu_io
+$QEMU_IO -c "open -o refcount-cache-size=0 $TEST_IMG" -c 'read -P 42 0 64k' \
+ | _filter_qemu_io
+
+# Derive cache sizes from combined size (with a reasonable ratio, but we cannot
+# test that)
+$QEMU_IO -c "open -o cache-size=2M $TEST_IMG" -c 'read -P 42 0 64k' \
+ | _filter_qemu_io
+# Fix one cache, derive the other
+$QEMU_IO -c "open -o cache-size=2M,l2-cache-size=1M $TEST_IMG" \
+ -c 'read -P 42 0 64k' \
+ | _filter_qemu_io
+$QEMU_IO -c "open -o cache-size=2M,refcount-cache-size=1M $TEST_IMG" \
+ -c 'read -P 42 0 64k' \
+ | _filter_qemu_io
+# Directly set both caches
+$QEMU_IO -c "open -o l2-cache-size=1M,refcount-cache-size=0.25M $TEST_IMG" \
+ -c 'read -P 42 0 64k' \
+ | _filter_qemu_io
+
+# success, all done
+echo '*** done'
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/103.out b/tests/qemu-iotests/103.out
new file mode 100644
index 0000000..ddf6b5a
--- /dev/null
+++ b/tests/qemu-iotests/103.out
@@ -0,0 +1,29 @@
+QA output created by 103
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536
+wrote 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+=== Testing invalid option combinations ===
+
+qemu-io: can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set the same time
+qemu-io: can't open device TEST_DIR/t.IMGFMT: l2-cache-size may not exceed cache-size
+qemu-io: can't open device TEST_DIR/t.IMGFMT: refcount-cache-size may not exceed cache-size
+qemu-io: can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set the same time
+
+=== Testing valid option combinations ===
+
+read 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 6e67f61..1c8d453 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -100,3 +100,4 @@
091 rw auto quick
092 rw auto quick
095 rw auto quick
+103 rw auto quick
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 11/29] test-coroutine: test cost introduced by coroutine
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (9 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 10/29] iotests: Add test for qcow2's cache options Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 12/29] qemu-iotests: Fix 028 reference output for qed Kevin Wolf
` (19 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Ming Lei <ming.lei@canonical.com>
This test runs dummy function with coroutine by using
two enter and one yield since which is a common usage.
So we can see the cost introduced by corouting for running
one function, for example:
Run operation 20000000 iterations 4.841071 s, 4131K operations/s
242ns per coroutine
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/test-coroutine.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c
index 6e634f4..e22fae1 100644
--- a/tests/test-coroutine.c
+++ b/tests/test-coroutine.c
@@ -311,6 +311,35 @@ static void perf_baseline(void)
maxcycles, duration);
}
+static __attribute__((noinline)) void perf_cost_func(void *opaque)
+{
+ qemu_coroutine_yield();
+}
+
+static void perf_cost(void)
+{
+ const unsigned long maxcycles = 40000000;
+ unsigned long i = 0;
+ double duration;
+ unsigned long ops;
+ Coroutine *co;
+
+ g_test_timer_start();
+ while (i++ < maxcycles) {
+ co = qemu_coroutine_create(perf_cost_func);
+ qemu_coroutine_enter(co, &i);
+ qemu_coroutine_enter(co, NULL);
+ }
+ duration = g_test_timer_elapsed();
+ ops = (long)(maxcycles / (duration * 1000));
+
+ g_test_message("Run operation %lu iterations %f s, %luK operations/s, "
+ "%luns per coroutine",
+ maxcycles,
+ duration, ops,
+ (unsigned long)(1000000000 * duration) / maxcycles);
+}
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
@@ -325,6 +354,7 @@ int main(int argc, char **argv)
g_test_add_func("/perf/nesting", perf_nesting);
g_test_add_func("/perf/yield", perf_yield);
g_test_add_func("/perf/function-call", perf_baseline);
+ g_test_add_func("/perf/cost", perf_cost);
}
return g_test_run();
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 12/29] qemu-iotests: Fix 028 reference output for qed
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (10 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 11/29] test-coroutine: test cost introduced by coroutine Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 13/29] block: acquire AioContext in qmp_block_resize() Kevin Wolf
` (18 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
We need to filter out driver-specific options in the "Formatting..."
string printed by qemu when creating the backup image.
Reported-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Peter Wu <peter@lekensteyn.nl>
---
tests/qemu-iotests/028 | 1 +
tests/qemu-iotests/028.out | 3 ++-
tests/qemu-iotests/common.filter | 22 ++++++++++++++++++++++
tests/qemu-iotests/common.rc | 19 +------------------
4 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
index 9e701e1..a1f4423 100755
--- a/tests/qemu-iotests/028
+++ b/tests/qemu-iotests/028
@@ -113,6 +113,7 @@ QEMU_COMM_TIMEOUT=1
# Silence output since it contains the disk image path and QEMU's readline
# character echoing makes it very hard to filter the output
_send_qemu_cmd $h "drive_backup disk ${TEST_IMG}.copy" "(qemu)" >/dev/null
+_send_qemu_cmd $h "" "Formatting" | _filter_img_create
qemu_cmd_repeat=20 _send_qemu_cmd $h "info block-jobs" "No active jobs"
_send_qemu_cmd $h 'quit' ""
diff --git a/tests/qemu-iotests/028.out b/tests/qemu-iotests/028.out
index 0e1a5ae..e8d0245 100644
--- a/tests/qemu-iotests/028.out
+++ b/tests/qemu-iotests/028.out
@@ -468,7 +468,8 @@ No errors were found on the image.
block-backup
-Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=4294968832 backing_file='TEST_DIR/t.qcow2.base' backing_fmt='qcow2' encryption=off cluster_size=65536 lazy_refcounts=off
+Formatting 'TEST_DIR/t.IMGFMT.copy', fmt=IMGFMT size=4294968832 backing_file='TEST_DIR/t.IMGFMT.base' backing_fmt='IMGFMT'
+(qemu)
(qemu) i^[[K^[[Din^[[K^[[D^[[Dinf^[[K^[[D^[[D^[[Dinfo^[[K^[[D^[[D^[[D^[[Dinfo ^[[K^[[D^[[D^[[D^[[D^[[Dinfo b^[[K^[[D^[[D^[[D^[[D^[[D^[[Dinfo bl^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo blo^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo bloc^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-j^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-jo^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-job^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-jobs^[[K
Type backup, device disk: Completed 0 of 4294968832 bytes, speed limit 0 bytes/s
i^[[K^[[Din^[[K^[[D^[[Dinf^[[K^[[D^[[D^[[Dinfo^[[K^[[D^[[D^[[D^[[Dinfo ^[[K^[[D^[[D^[[D^[[D^[[Dinfo b^[[K^[[D^[[D^[[D^[[D^[[D^[[Dinfo bl^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo blo^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo bloc^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-j^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-jo^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-job^[[K^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[D^[[Dinfo block-jobs^[[K
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index a04df7f..51192c8 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -170,5 +170,27 @@ _filter_qmp()
-e 's#^{"QMP":.*}$#QMP_VERSION#'
}
+# replace driver-specific options in the "Formatting..." line
+_filter_img_create()
+{
+ sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
+ -e "s#$TEST_DIR#TEST_DIR#g" \
+ -e "s#$IMGFMT#IMGFMT#g" \
+ -e "s# encryption=off##g" \
+ -e "s# cluster_size=[0-9]\\+##g" \
+ -e "s# table_size=[0-9]\\+##g" \
+ -e "s# compat='[^']*'##g" \
+ -e "s# compat6=\\(on\\|off\\)##g" \
+ -e "s# static=\\(on\\|off\\)##g" \
+ -e "s# zeroed_grain=\\(on\\|off\\)##g" \
+ -e "s# subformat='[^']*'##g" \
+ -e "s# adapter_type='[^']*'##g" \
+ -e "s# lazy_refcounts=\\(on\\|off\\)##g" \
+ -e "s# block_size=[0-9]\\+##g" \
+ -e "s# block_state_zero=\\(on\\|off\\)##g" \
+ -e "s# log_size=[0-9]\\+##g" \
+ -e "s/archipelago:a/TEST_DIR\//g"
+}
+
# make sure this script returns success
/bin/true
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 3fd691e..9c49deb 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -149,24 +149,7 @@ _make_test_img()
else
$QEMU_IMG create -f $IMGFMT $extra_img_options "$img_name" $image_size 2>&1
fi
- ) | \
- sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
- -e "s#$TEST_DIR#TEST_DIR#g" \
- -e "s#$IMGFMT#IMGFMT#g" \
- -e "s# encryption=off##g" \
- -e "s# cluster_size=[0-9]\\+##g" \
- -e "s# table_size=[0-9]\\+##g" \
- -e "s# compat='[^']*'##g" \
- -e "s# compat6=\\(on\\|off\\)##g" \
- -e "s# static=\\(on\\|off\\)##g" \
- -e "s# zeroed_grain=\\(on\\|off\\)##g" \
- -e "s# subformat='[^']*'##g" \
- -e "s# adapter_type='[^']*'##g" \
- -e "s# lazy_refcounts=\\(on\\|off\\)##g" \
- -e "s# block_size=[0-9]\\+##g" \
- -e "s# block_state_zero=\\(on\\|off\\)##g" \
- -e "s# log_size=[0-9]\\+##g" \
- -e "s/archipelago:a/TEST_DIR\//g"
+ ) | _filter_img_create
# Start an NBD server on the image file, which is what we'll be talking to
if [ $IMGPROTO = "nbd" ]; then
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 13/29] block: acquire AioContext in qmp_block_resize()
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (11 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 12/29] qemu-iotests: Fix 028 reference output for qed Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 14/29] virtio-blk: allow block_resize with dataplane Kevin Wolf
` (17 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Stefan Hajnoczi <stefanha@redhat.com>
Make block_resize safe for dataplane where another thread may be running
the BlockDriverState's AioContext.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
blockdev.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 8acd264..6a204c6 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1799,6 +1799,7 @@ void qmp_block_resize(bool has_device, const char *device,
{
Error *local_err = NULL;
BlockDriverState *bs;
+ AioContext *aio_context;
int ret;
bs = bdrv_lookup_bs(has_device ? device : NULL,
@@ -1809,19 +1810,22 @@ void qmp_block_resize(bool has_device, const char *device,
return;
}
+ aio_context = bdrv_get_aio_context(bs);
+ aio_context_acquire(aio_context);
+
if (!bdrv_is_first_non_filter(bs)) {
error_set(errp, QERR_FEATURE_DISABLED, "resize");
- return;
+ goto out;
}
if (size < 0) {
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
- return;
+ goto out;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) {
error_set(errp, QERR_DEVICE_IN_USE, device);
- return;
+ goto out;
}
/* complete all in-flight operations before resizing the device */
@@ -1847,6 +1851,9 @@ void qmp_block_resize(bool has_device, const char *device,
error_setg_errno(errp, -ret, "Could not resize");
break;
}
+
+out:
+ aio_context_release(aio_context);
}
static void block_job_cb(void *opaque, int ret)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 14/29] virtio-blk: allow block_resize with dataplane
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (12 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 13/29] block: acquire AioContext in qmp_block_resize() Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 15/29] virtio-blk: fix reference a pointer which might be freed Kevin Wolf
` (16 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Stefan Hajnoczi <stefanha@redhat.com>
Now that block_resize acquires the AioContext we can safely allow
resizing the disk.
Reported-by: Andrey Korolyov <andrey@xdel.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hw/block/dataplane/virtio-blk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 24a6b71..c07adc6 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -193,6 +193,7 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
error_setg(&s->blocker, "block device is in use by data plane");
bdrv_op_block_all(blk->conf.bs, s->blocker);
+ bdrv_op_unblock(blk->conf.bs, BLOCK_OP_TYPE_RESIZE, s->blocker);
*dataplane = s;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 15/29] virtio-blk: fix reference a pointer which might be freed
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (13 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 14/29] virtio-blk: allow block_resize with dataplane Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 16/29] block: Add bdrv_refresh_filename() Kevin Wolf
` (15 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
In function virtio_blk_handle_request, it may freed memory pointed by req,
So do not access member of req after calling this function.
Cc: qemu-stable@nongnu.org
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hw/block/virtio-blk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 302c39e..d9167ce 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -469,8 +469,9 @@ static void virtio_blk_dma_restart_bh(void *opaque)
s->rq = NULL;
while (req) {
+ VirtIOBlockReq *next = req->next;
virtio_blk_handle_request(req, &mrb);
- req = req->next;
+ req = next;
}
virtio_submit_multiwrite(s->bs, &mrb);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 16/29] block: Add bdrv_refresh_filename()
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (14 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 15/29] virtio-blk: fix reference a pointer which might be freed Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 17/29] blkdebug: Implement bdrv_refresh_filename() Kevin Wolf
` (14 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Some block devices may not have a filename in their BDS; and for some,
there may not even be a normal filename at all. To work around this, add
a function which tries to construct a valid filename for the
BDS.filename field.
If a filename exists or a block driver is able to reconstruct a valid
filename (which is placed in BDS.exact_filename), this can directly be
used.
If no filename can be constructed, we can still construct an options
QDict which is then converted to a JSON object and prefixed with the
"json:" pseudo protocol prefix. The QDict is placed in
BDS.full_open_options.
For most block drivers, this process can be done automatically; those
that need special handling may define a .bdrv_refresh_filename() method
to fill BDS.exact_filename and BDS.full_open_options themselves.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++
include/block/block.h | 1 +
include/block/block_int.h | 6 +++
3 files changed, 142 insertions(+)
diff --git a/block.c b/block.c
index 712f5db..e9380f6 100644
--- a/block.c
+++ b/block.c
@@ -964,6 +964,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
} else {
bs->filename[0] = '\0';
}
+ pstrcpy(bs->exact_filename, sizeof(bs->exact_filename), bs->filename);
bs->drv = drv;
bs->opaque = g_malloc0(drv->instance_size);
@@ -1505,6 +1506,8 @@ int bdrv_open(BlockDriverState **pbs, const char *filename,
}
}
+ bdrv_refresh_filename(bs);
+
/* For snapshot=on, create a temporary qcow2 overlay. bs points to the
* temporary snapshot afterwards. */
if (snapshot_flags) {
@@ -1845,6 +1848,8 @@ void bdrv_close(BlockDriverState *bs)
bs->zero_beyond_eof = false;
QDECREF(bs->options);
bs->options = NULL;
+ QDECREF(bs->full_open_options);
+ bs->full_open_options = NULL;
if (bs->file != NULL) {
bdrv_unref(bs->file);
@@ -5894,3 +5899,133 @@ void bdrv_flush_io_queue(BlockDriverState *bs)
bdrv_flush_io_queue(bs->file);
}
}
+
+static bool append_open_options(QDict *d, BlockDriverState *bs)
+{
+ const QDictEntry *entry;
+ bool found_any = false;
+
+ for (entry = qdict_first(bs->options); entry;
+ entry = qdict_next(bs->options, entry))
+ {
+ /* Only take options for this level and exclude all non-driver-specific
+ * options */
+ if (!strchr(qdict_entry_key(entry), '.') &&
+ strcmp(qdict_entry_key(entry), "node-name"))
+ {
+ qobject_incref(qdict_entry_value(entry));
+ qdict_put_obj(d, qdict_entry_key(entry), qdict_entry_value(entry));
+ found_any = true;
+ }
+ }
+
+ return found_any;
+}
+
+/* Updates the following BDS fields:
+ * - exact_filename: A filename which may be used for opening a block device
+ * which (mostly) equals the given BDS (even without any
+ * other options; so reading and writing must return the same
+ * results, but caching etc. may be different)
+ * - full_open_options: Options which, when given when opening a block device
+ * (without a filename), result in a BDS (mostly)
+ * equalling the given one
+ * - filename: If exact_filename is set, it is copied here. Otherwise,
+ * full_open_options is converted to a JSON object, prefixed with
+ * "json:" (for use through the JSON pseudo protocol) and put here.
+ */
+void bdrv_refresh_filename(BlockDriverState *bs)
+{
+ BlockDriver *drv = bs->drv;
+ QDict *opts;
+
+ if (!drv) {
+ return;
+ }
+
+ /* This BDS's file name will most probably depend on its file's name, so
+ * refresh that first */
+ if (bs->file) {
+ bdrv_refresh_filename(bs->file);
+ }
+
+ if (drv->bdrv_refresh_filename) {
+ /* Obsolete information is of no use here, so drop the old file name
+ * information before refreshing it */
+ bs->exact_filename[0] = '\0';
+ if (bs->full_open_options) {
+ QDECREF(bs->full_open_options);
+ bs->full_open_options = NULL;
+ }
+
+ drv->bdrv_refresh_filename(bs);
+ } else if (bs->file) {
+ /* Try to reconstruct valid information from the underlying file */
+ bool has_open_options;
+
+ bs->exact_filename[0] = '\0';
+ if (bs->full_open_options) {
+ QDECREF(bs->full_open_options);
+ bs->full_open_options = NULL;
+ }
+
+ opts = qdict_new();
+ has_open_options = append_open_options(opts, bs);
+
+ /* If no specific options have been given for this BDS, the filename of
+ * the underlying file should suffice for this one as well */
+ if (bs->file->exact_filename[0] && !has_open_options) {
+ strcpy(bs->exact_filename, bs->file->exact_filename);
+ }
+ /* Reconstructing the full options QDict is simple for most format block
+ * drivers, as long as the full options are known for the underlying
+ * file BDS. The full options QDict of that file BDS should somehow
+ * contain a representation of the filename, therefore the following
+ * suffices without querying the (exact_)filename of this BDS. */
+ if (bs->file->full_open_options) {
+ qdict_put_obj(opts, "driver",
+ QOBJECT(qstring_from_str(drv->format_name)));
+ QINCREF(bs->file->full_open_options);
+ qdict_put_obj(opts, "file", QOBJECT(bs->file->full_open_options));
+
+ bs->full_open_options = opts;
+ } else {
+ QDECREF(opts);
+ }
+ } else if (!bs->full_open_options && qdict_size(bs->options)) {
+ /* There is no underlying file BDS (at least referenced by BDS.file),
+ * so the full options QDict should be equal to the options given
+ * specifically for this block device when it was opened (plus the
+ * driver specification).
+ * Because those options don't change, there is no need to update
+ * full_open_options when it's already set. */
+
+ opts = qdict_new();
+ append_open_options(opts, bs);
+ qdict_put_obj(opts, "driver",
+ QOBJECT(qstring_from_str(drv->format_name)));
+
+ if (bs->exact_filename[0]) {
+ /* This may not work for all block protocol drivers (some may
+ * require this filename to be parsed), but we have to find some
+ * default solution here, so just include it. If some block driver
+ * does not support pure options without any filename at all or
+ * needs some special format of the options QDict, it needs to
+ * implement the driver-specific bdrv_refresh_filename() function.
+ */
+ qdict_put_obj(opts, "filename",
+ QOBJECT(qstring_from_str(bs->exact_filename)));
+ }
+
+ bs->full_open_options = opts;
+ }
+
+ if (bs->exact_filename[0]) {
+ pstrcpy(bs->filename, sizeof(bs->filename), bs->exact_filename);
+ } else if (bs->full_open_options) {
+ QString *json = qobject_to_json(QOBJECT(bs->full_open_options));
+ snprintf(bs->filename, sizeof(bs->filename), "json:%s",
+ qstring_get_str(json));
+ QDECREF(json);
+ }
+}
diff --git a/include/block/block.h b/include/block/block.h
index e94b701..8f4ad16 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -274,6 +274,7 @@ int coroutine_fn bdrv_co_write_zeroes(BlockDriverState *bs, int64_t sector_num,
BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs,
const char *backing_file);
int bdrv_get_backing_file_depth(BlockDriverState *bs);
+void bdrv_refresh_filename(BlockDriverState *bs);
int bdrv_truncate(BlockDriverState *bs, int64_t offset);
int64_t bdrv_nb_sectors(BlockDriverState *bs);
int64_t bdrv_getlength(BlockDriverState *bs);
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 7b541a0..2334895 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -123,6 +123,9 @@ struct BlockDriver {
int (*bdrv_create)(const char *filename, QemuOpts *opts, Error **errp);
int (*bdrv_set_key)(BlockDriverState *bs, const char *key);
int (*bdrv_make_empty)(BlockDriverState *bs);
+
+ void (*bdrv_refresh_filename)(BlockDriverState *bs);
+
/* aio */
BlockDriverAIOCB *(*bdrv_aio_readv)(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
@@ -323,6 +326,9 @@ struct BlockDriverState {
this file image */
char backing_format[16]; /* if non-zero and backing_file exists */
+ QDict *full_open_options;
+ char exact_filename[1024];
+
BlockDriverState *backing_hd;
BlockDriverState *file;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 17/29] blkdebug: Implement bdrv_refresh_filename()
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (15 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 16/29] block: Add bdrv_refresh_filename() Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 18/29] blkverify: " Kevin Wolf
` (13 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Because blkdebug cannot simply create a configuration file, simply
refuse to reconstruct a plain filename and only generate an options
QDict from the rules instead.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/blkdebug.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
diff --git a/block/blkdebug.c b/block/blkdebug.c
index 1586ed9..95b7244 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -26,6 +26,10 @@
#include "qemu/config-file.h"
#include "block/block_int.h"
#include "qemu/module.h"
+#include "qapi/qmp/qbool.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qint.h"
+#include "qapi/qmp/qstring.h"
typedef struct BDRVBlkdebugState {
int state;
@@ -706,6 +710,98 @@ static int64_t blkdebug_getlength(BlockDriverState *bs)
return bdrv_getlength(bs->file);
}
+static void blkdebug_refresh_filename(BlockDriverState *bs)
+{
+ BDRVBlkdebugState *s = bs->opaque;
+ struct BlkdebugRule *rule;
+ QDict *opts;
+ QList *inject_error_list = NULL, *set_state_list = NULL;
+ QList *suspend_list = NULL;
+ int event;
+
+ if (!bs->file->full_open_options) {
+ /* The config file cannot be recreated, so creating a plain filename
+ * is impossible */
+ return;
+ }
+
+ opts = qdict_new();
+ qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkdebug")));
+
+ QINCREF(bs->file->full_open_options);
+ qdict_put_obj(opts, "image", QOBJECT(bs->file->full_open_options));
+
+ for (event = 0; event < BLKDBG_EVENT_MAX; event++) {
+ QLIST_FOREACH(rule, &s->rules[event], next) {
+ if (rule->action == ACTION_INJECT_ERROR) {
+ QDict *inject_error = qdict_new();
+
+ qdict_put_obj(inject_error, "event", QOBJECT(qstring_from_str(
+ BlkdebugEvent_lookup[rule->event])));
+ qdict_put_obj(inject_error, "state",
+ QOBJECT(qint_from_int(rule->state)));
+ qdict_put_obj(inject_error, "errno", QOBJECT(qint_from_int(
+ rule->options.inject.error)));
+ qdict_put_obj(inject_error, "sector", QOBJECT(qint_from_int(
+ rule->options.inject.sector)));
+ qdict_put_obj(inject_error, "once", QOBJECT(qbool_from_int(
+ rule->options.inject.once)));
+ qdict_put_obj(inject_error, "immediately",
+ QOBJECT(qbool_from_int(
+ rule->options.inject.immediately)));
+
+ if (!inject_error_list) {
+ inject_error_list = qlist_new();
+ }
+
+ qlist_append_obj(inject_error_list, QOBJECT(inject_error));
+ } else if (rule->action == ACTION_SET_STATE) {
+ QDict *set_state = qdict_new();
+
+ qdict_put_obj(set_state, "event", QOBJECT(qstring_from_str(
+ BlkdebugEvent_lookup[rule->event])));
+ qdict_put_obj(set_state, "state",
+ QOBJECT(qint_from_int(rule->state)));
+ qdict_put_obj(set_state, "new_state", QOBJECT(qint_from_int(
+ rule->options.set_state.new_state)));
+
+ if (!set_state_list) {
+ set_state_list = qlist_new();
+ }
+
+ qlist_append_obj(set_state_list, QOBJECT(set_state));
+ } else if (rule->action == ACTION_SUSPEND) {
+ QDict *suspend = qdict_new();
+
+ qdict_put_obj(suspend, "event", QOBJECT(qstring_from_str(
+ BlkdebugEvent_lookup[rule->event])));
+ qdict_put_obj(suspend, "state",
+ QOBJECT(qint_from_int(rule->state)));
+ qdict_put_obj(suspend, "tag", QOBJECT(qstring_from_str(
+ rule->options.suspend.tag)));
+
+ if (!suspend_list) {
+ suspend_list = qlist_new();
+ }
+
+ qlist_append_obj(suspend_list, QOBJECT(suspend));
+ }
+ }
+ }
+
+ if (inject_error_list) {
+ qdict_put_obj(opts, "inject-error", QOBJECT(inject_error_list));
+ }
+ if (set_state_list) {
+ qdict_put_obj(opts, "set-state", QOBJECT(set_state_list));
+ }
+ if (suspend_list) {
+ qdict_put_obj(opts, "suspend", QOBJECT(suspend_list));
+ }
+
+ bs->full_open_options = opts;
+}
+
static BlockDriver bdrv_blkdebug = {
.format_name = "blkdebug",
.protocol_name = "blkdebug",
@@ -715,6 +811,7 @@ static BlockDriver bdrv_blkdebug = {
.bdrv_file_open = blkdebug_open,
.bdrv_close = blkdebug_close,
.bdrv_getlength = blkdebug_getlength,
+ .bdrv_refresh_filename = blkdebug_refresh_filename,
.bdrv_aio_readv = blkdebug_aio_readv,
.bdrv_aio_writev = blkdebug_aio_writev,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 18/29] blkverify: Implement bdrv_refresh_filename()
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (16 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 17/29] blkdebug: Implement bdrv_refresh_filename() Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 19/29] nbd: " Kevin Wolf
` (12 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/blkverify.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/block/blkverify.c b/block/blkverify.c
index 621b785..7c78ca4 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -10,6 +10,8 @@
#include <stdarg.h>
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
#include "block/block_int.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qstring.h"
typedef struct {
BlockDriverState *test_file;
@@ -320,6 +322,32 @@ static void blkverify_attach_aio_context(BlockDriverState *bs,
bdrv_attach_aio_context(s->test_file, new_context);
}
+static void blkverify_refresh_filename(BlockDriverState *bs)
+{
+ BDRVBlkverifyState *s = bs->opaque;
+
+ /* bs->file has already been refreshed */
+ bdrv_refresh_filename(s->test_file);
+
+ if (bs->file->full_open_options && s->test_file->full_open_options) {
+ QDict *opts = qdict_new();
+ qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("blkverify")));
+
+ QINCREF(bs->file->full_open_options);
+ qdict_put_obj(opts, "raw", QOBJECT(bs->file->full_open_options));
+ QINCREF(s->test_file->full_open_options);
+ qdict_put_obj(opts, "test", QOBJECT(s->test_file->full_open_options));
+
+ bs->full_open_options = opts;
+ }
+
+ if (bs->file->exact_filename[0] && s->test_file->exact_filename[0]) {
+ snprintf(bs->exact_filename, sizeof(bs->exact_filename),
+ "blkverify:%s:%s",
+ bs->file->exact_filename, s->test_file->exact_filename);
+ }
+}
+
static BlockDriver bdrv_blkverify = {
.format_name = "blkverify",
.protocol_name = "blkverify",
@@ -329,6 +357,7 @@ static BlockDriver bdrv_blkverify = {
.bdrv_file_open = blkverify_open,
.bdrv_close = blkverify_close,
.bdrv_getlength = blkverify_getlength,
+ .bdrv_refresh_filename = blkverify_refresh_filename,
.bdrv_aio_readv = blkverify_aio_readv,
.bdrv_aio_writev = blkverify_aio_writev,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 19/29] nbd: Implement bdrv_refresh_filename()
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (17 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 18/29] blkverify: " Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 20/29] quorum: " Kevin Wolf
` (11 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/nbd.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/block/nbd.c b/block/nbd.c
index 4eda095..89775e1 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -31,8 +31,10 @@
#include "block/block_int.h"
#include "qemu/module.h"
#include "qemu/sockets.h"
+#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qjson.h"
#include "qapi/qmp/qint.h"
+#include "qapi/qmp/qstring.h"
#include <sys/types.h>
#include <unistd.h>
@@ -338,6 +340,37 @@ static void nbd_attach_aio_context(BlockDriverState *bs,
nbd_client_session_attach_aio_context(&s->client, new_context);
}
+static void nbd_refresh_filename(BlockDriverState *bs)
+{
+ BDRVNBDState *s = bs->opaque;
+ QDict *opts = qdict_new();
+ const char *path = qemu_opt_get(s->socket_opts, "path");
+ const char *host = qemu_opt_get(s->socket_opts, "host");
+ const char *port = qemu_opt_get(s->socket_opts, "port");
+ const char *export = qemu_opt_get(s->socket_opts, "export");
+
+ qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("nbd")));
+
+ if (path) {
+ snprintf(bs->exact_filename, sizeof(bs->exact_filename),
+ "nbd+unix:%s", path);
+ qdict_put_obj(opts, "path", QOBJECT(qstring_from_str(path)));
+ } else if (export) {
+ snprintf(bs->exact_filename, sizeof(bs->exact_filename),
+ "nbd:%s:%s/%s", host, port, export);
+ qdict_put_obj(opts, "host", QOBJECT(qstring_from_str(host)));
+ qdict_put_obj(opts, "port", QOBJECT(qstring_from_str(port)));
+ qdict_put_obj(opts, "export", QOBJECT(qstring_from_str(export)));
+ } else {
+ snprintf(bs->exact_filename, sizeof(bs->exact_filename),
+ "nbd:%s:%s", host, port);
+ qdict_put_obj(opts, "host", QOBJECT(qstring_from_str(host)));
+ qdict_put_obj(opts, "port", QOBJECT(qstring_from_str(port)));
+ }
+
+ bs->full_open_options = opts;
+}
+
static BlockDriver bdrv_nbd = {
.format_name = "nbd",
.protocol_name = "nbd",
@@ -352,6 +385,7 @@ static BlockDriver bdrv_nbd = {
.bdrv_getlength = nbd_getlength,
.bdrv_detach_aio_context = nbd_detach_aio_context,
.bdrv_attach_aio_context = nbd_attach_aio_context,
+ .bdrv_refresh_filename = nbd_refresh_filename,
};
static BlockDriver bdrv_nbd_tcp = {
@@ -368,6 +402,7 @@ static BlockDriver bdrv_nbd_tcp = {
.bdrv_getlength = nbd_getlength,
.bdrv_detach_aio_context = nbd_detach_aio_context,
.bdrv_attach_aio_context = nbd_attach_aio_context,
+ .bdrv_refresh_filename = nbd_refresh_filename,
};
static BlockDriver bdrv_nbd_unix = {
@@ -384,6 +419,7 @@ static BlockDriver bdrv_nbd_unix = {
.bdrv_getlength = nbd_getlength,
.bdrv_detach_aio_context = nbd_detach_aio_context,
.bdrv_attach_aio_context = nbd_attach_aio_context,
+ .bdrv_refresh_filename = nbd_refresh_filename,
};
static void bdrv_nbd_init(void)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 20/29] quorum: Implement bdrv_refresh_filename()
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (18 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 19/29] nbd: " Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 21/29] iotests: Add test for image filename construction Kevin Wolf
` (10 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/quorum.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/block/quorum.c b/block/quorum.c
index d5ee9c0..0de07bb 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -16,7 +16,12 @@
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
#include "block/block_int.h"
+#include "qapi/qmp/qbool.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qint.h"
#include "qapi/qmp/qjson.h"
+#include "qapi/qmp/qlist.h"
+#include "qapi/qmp/qstring.h"
#include "qapi-event.h"
#define HASH_LENGTH 32
@@ -945,6 +950,39 @@ static void quorum_attach_aio_context(BlockDriverState *bs,
}
}
+static void quorum_refresh_filename(BlockDriverState *bs)
+{
+ BDRVQuorumState *s = bs->opaque;
+ QDict *opts;
+ QList *children;
+ int i;
+
+ for (i = 0; i < s->num_children; i++) {
+ bdrv_refresh_filename(s->bs[i]);
+ if (!s->bs[i]->full_open_options) {
+ return;
+ }
+ }
+
+ children = qlist_new();
+ for (i = 0; i < s->num_children; i++) {
+ QINCREF(s->bs[i]->full_open_options);
+ qlist_append_obj(children, QOBJECT(s->bs[i]->full_open_options));
+ }
+
+ opts = qdict_new();
+ qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("quorum")));
+ qdict_put_obj(opts, QUORUM_OPT_VOTE_THRESHOLD,
+ QOBJECT(qint_from_int(s->threshold)));
+ qdict_put_obj(opts, QUORUM_OPT_BLKVERIFY,
+ QOBJECT(qbool_from_int(s->is_blkverify)));
+ qdict_put_obj(opts, QUORUM_OPT_REWRITE,
+ QOBJECT(qbool_from_int(s->rewrite_corrupted)));
+ qdict_put_obj(opts, "children", QOBJECT(children));
+
+ bs->full_open_options = opts;
+}
+
static BlockDriver bdrv_quorum = {
.format_name = "quorum",
.protocol_name = "quorum",
@@ -953,6 +991,7 @@ static BlockDriver bdrv_quorum = {
.bdrv_file_open = quorum_open,
.bdrv_close = quorum_close,
+ .bdrv_refresh_filename = quorum_refresh_filename,
.bdrv_co_flush_to_disk = quorum_co_flush,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 21/29] iotests: Add test for image filename construction
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (19 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 20/29] quorum: " Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 22/29] block/vvfat.c: remove debugging code to reinit stderr if NULL Kevin Wolf
` (9 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Testing a real in-use protocol such as NBD is hard; testing blkdebug and
blkverify in its stead is easier and tests basically the same
functionality.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/qemu-iotests/099 | 116 +++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/099.out | 20 ++++++++
tests/qemu-iotests/group | 1 +
3 files changed, 137 insertions(+)
create mode 100755 tests/qemu-iotests/099
create mode 100644 tests/qemu-iotests/099.out
diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
new file mode 100755
index 0000000..a26d3d2
--- /dev/null
+++ b/tests/qemu-iotests/099
@@ -0,0 +1,116 @@
+#!/bin/bash
+#
+# Test valid filenames for blkdebug and blkverify representatively for
+# other protocols (such as NBD) when queried
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=mreitz@redhat.com
+
+seq="$(basename $0)"
+echo "QA output created by $seq"
+
+here="$PWD"
+tmp=/tmp/$$
+status=1 # failure is the default!
+
+_cleanup()
+{
+ _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+# Basically all formats, but "raw" has issues with _filter_imgfmt regarding the
+# raw comparison image for blkverify; also, all images have to support creation
+_supported_fmt cow qcow qcow2 qed vdi vhdx vmdk vpc
+_supported_proto file
+_supported_os Linux
+
+
+function do_run_qemu()
+{
+ $QEMU -nographic -qmp stdio -serial none "$@"
+}
+
+function run_qemu()
+{
+ # Get the "file": "foo" entry ($foo may only contain escaped double quotes,
+ # which is how we can extract it)
+ do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt | _filter_qmp \
+ | grep "drv0" \
+ | sed -e 's/^.*"file": "\(\(\\"\|[^"]\)*\)".*$/\1/' -e 's/\\"/"/g'
+}
+
+function test_qemu()
+{
+ run_qemu -drive "if=none,id=drv0,$1" <<EOF
+ { 'execute': 'qmp_capabilities' }
+ { 'execute': 'query-block' }
+ { 'execute': 'quit' }
+EOF
+}
+
+
+
+IMG_SIZE=128K
+
+_make_test_img $IMG_SIZE
+$QEMU_IMG create -f raw "$TEST_IMG.compare" $IMG_SIZE \
+ | _filter_testdir | _filter_imgfmt
+
+echo
+echo '=== Testing simple filename for blkverify ==='
+echo
+
+# This should return simply the filename itself
+test_qemu "file=blkverify:$TEST_IMG.compare:$TEST_IMG"
+
+echo
+echo '=== Testing filename reconstruction for blkverify ==='
+echo
+
+# This should return the same filename as above
+test_qemu "file.driver=blkverify,file.raw.filename=$TEST_IMG.compare,file.test.file.filename=$TEST_IMG"
+
+echo
+echo '=== Testing JSON filename for blkdebug ==='
+echo
+
+# blkdebug cannot create a configuration file, therefore it is unable to
+# generate a plain filename here; thus this should return a JSON filename
+test_qemu "file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=l1_update"
+
+echo
+echo '=== Testing indirectly enforced JSON filename ==='
+echo
+
+# Because blkdebug cannot return a plain filename, blkverify is forced to
+# generate a JSON object here as well
+test_qemu "file.driver=blkverify,file.raw.filename=$TEST_IMG.compare,file.test.file.driver=blkdebug,file.test.file.image.filename=$TEST_IMG,file.test.file.inject-error.0.event=l1_update"
+
+
+rm -f "$TEST_IMG.compare"
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/099.out b/tests/qemu-iotests/099.out
new file mode 100644
index 0000000..55be4d4
--- /dev/null
+++ b/tests/qemu-iotests/099.out
@@ -0,0 +1,20 @@
+QA output created by 099
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072
+Formatting 'TEST_DIR/t.IMGFMT.compare', fmt=raw size=131072
+
+=== Testing simple filename for blkverify ===
+
+blkverify:TEST_DIR/t.IMGFMT.compare:TEST_DIR/t.IMGFMT
+
+=== Testing filename reconstruction for blkverify ===
+
+blkverify:TEST_DIR/t.IMGFMT.compare:TEST_DIR/t.IMGFMT
+
+=== Testing JSON filename for blkdebug ===
+
+json:{"driver": "IMGFMT", "file": {"inject-error": [{"immediately": false, "once": false, "state": 0, "sector": -1, "event": "l1_update", "errno": 5}], "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug"}}
+
+=== Testing indirectly enforced JSON filename ===
+
+json:{"driver": "raw", "file": {"test": {"driver": "IMGFMT", "file": {"inject-error": [{"immediately": false, "once": false, "state": 0, "sector": -1, "event": "l1_update", "errno": 5}], "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug"}}, "driver": "blkverify", "raw": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT.compare"}}}
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 1c8d453..f157864 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -100,4 +100,5 @@
091 rw auto quick
092 rw auto quick
095 rw auto quick
+099 rw auto quick
103 rw auto quick
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 22/29] block/vvfat.c: remove debugging code to reinit stderr if NULL
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (20 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 21/29] iotests: Add test for image filename construction Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 23/29] block/iscsi: fix memory corruption on iscsi resize Kevin Wolf
` (8 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Michael Tokarev <mjt@tls.msk.ru>
Just log to stderr unconditionally, like other similar code does.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vvfat.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index e56f766..731e591 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -52,10 +52,6 @@
#define DLOG(a) a
-#undef stderr
-#define stderr STDERR
-FILE* stderr = NULL;
-
static void checkpoint(void);
#ifdef __MINGW32__
@@ -1082,11 +1078,6 @@ static int vvfat_open(BlockDriverState *bs, QDict *options, int flags,
vvv = s;
#endif
-DLOG(if (stderr == NULL) {
- stderr = fopen("vvfat.log", "a");
- setbuf(stderr, NULL);
-})
-
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
qemu_opts_absorb_qdict(opts, options, &local_err);
if (local_err) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 23/29] block/iscsi: fix memory corruption on iscsi resize
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (21 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 22/29] block/vvfat.c: remove debugging code to reinit stderr if NULL Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 24/29] raw-posix: fix O_DIRECT short reads Kevin Wolf
` (7 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Peter Lieven <pl@kamp.de>
bs->total_sectors is not yet updated at this point. resulting
in memory corruption if the volume has grown and data is written
to the newly availble areas.
CC: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/iscsi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index cdd19c2..3e19202 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1512,7 +1512,8 @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset)
if (iscsilun->allocationmap != NULL) {
g_free(iscsilun->allocationmap);
iscsilun->allocationmap =
- bitmap_new(DIV_ROUND_UP(bs->total_sectors,
+ bitmap_new(DIV_ROUND_UP(sector_lun2qemu(iscsilun->num_blocks,
+ iscsilun),
iscsilun->cluster_sectors));
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 24/29] raw-posix: fix O_DIRECT short reads
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (22 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 23/29] block/iscsi: fix memory corruption on iscsi resize Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 25/29] qemu-iotests: add test case 101 for short file I/O Kevin Wolf
` (6 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Stefan Hajnoczi <stefanha@redhat.com>
The following O_DIRECT read from a <512 byte file fails:
$ truncate -s 320 test.img
$ qemu-io -n -c 'read -P 0 0 512' test.img
qemu-io: can't open device test.img: Could not read image for determining its format: Invalid argument
Note that qemu-io completes successfully without the -n (O_DIRECT)
option.
This patch fixes qemu-iotests ./check -nocache -vmdk 059.
Cc: qemu-stable@nongnu.org
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/raw-posix.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 5c745b9..d737f3a 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -747,6 +747,15 @@ static ssize_t handle_aiocb_rw_linear(RawPosixAIOData *aiocb, char *buf)
}
if (len == -1 && errno == EINTR) {
continue;
+ } else if (len == -1 && errno == EINVAL &&
+ (aiocb->bs->open_flags & BDRV_O_NOCACHE) &&
+ !(aiocb->aio_type & QEMU_AIO_WRITE) &&
+ offset > 0) {
+ /* O_DIRECT pread() may fail with EINVAL when offset is unaligned
+ * after a short read. Assume that O_DIRECT short reads only occur
+ * at EOF. Therefore this is a short read, not an I/O error.
+ */
+ break;
} else if (len == -1) {
offset = -errno;
break;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 25/29] qemu-iotests: add test case 101 for short file I/O
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (23 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 24/29] raw-posix: fix O_DIRECT short reads Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 26/29] blkdebug: Delete BH in bdrv_aio_cancel Kevin Wolf
` (5 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/qemu-iotests/101 | 58 ++++++++++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/101.out | 10 ++++++++
tests/qemu-iotests/group | 1 +
3 files changed, 69 insertions(+)
create mode 100755 tests/qemu-iotests/101
create mode 100644 tests/qemu-iotests/101.out
diff --git a/tests/qemu-iotests/101 b/tests/qemu-iotests/101
new file mode 100755
index 0000000..70fbf25
--- /dev/null
+++ b/tests/qemu-iotests/101
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Test short file I/O
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=stefanha@redhat.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+
+_cleanup()
+{
+ _cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fmt raw
+_supported_proto file
+_supported_os Linux
+
+
+echo
+echo "== creating short image file =="
+dd if=/dev/zero of="$TEST_IMG" bs=1 count=320
+
+echo
+echo "== reading bytes beyond EOF gives zeroes =="
+$QEMU_IO -c "read -P 0 0 512" "$TEST_IMG" | _filter_qemu_io
+
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/101.out b/tests/qemu-iotests/101.out
new file mode 100644
index 0000000..9a996e8
--- /dev/null
+++ b/tests/qemu-iotests/101.out
@@ -0,0 +1,10 @@
+QA output created by 101
+
+== creating short image file ==
+320+0 records in
+320+0 records out
+
+== reading bytes beyond EOF gives zeroes ==
+read 512/512 bytes at offset 0
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index f157864..2803d68 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -101,4 +101,5 @@
092 rw auto quick
095 rw auto quick
099 rw auto quick
+101 rw auto quick
103 rw auto quick
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 26/29] blkdebug: Delete BH in bdrv_aio_cancel
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (24 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 25/29] qemu-iotests: add test case 101 for short file I/O Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 27/29] vmdk: Use bdrv_nb_sectors() where sectors, not bytes are wanted Kevin Wolf
` (4 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Fam Zheng <famz@redhat.com>
Otherwise error_callback_bh will access the already released acb.
Cc: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/blkdebug.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/blkdebug.c b/block/blkdebug.c
index 95b7244..69b330e 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -453,6 +453,10 @@ static void error_callback_bh(void *opaque)
static void blkdebug_aio_cancel(BlockDriverAIOCB *blockacb)
{
BlkdebugAIOCB *acb = container_of(blockacb, BlkdebugAIOCB, common);
+ if (acb->bh) {
+ qemu_bh_delete(acb->bh);
+ acb->bh = NULL;
+ }
qemu_aio_release(acb);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 27/29] vmdk: Use bdrv_nb_sectors() where sectors, not bytes are wanted
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (25 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 26/29] blkdebug: Delete BH in bdrv_aio_cancel Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 28/29] qemu-img: Allow source cache mode specification Kevin Wolf
` (3 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Markus Armbruster <armbru@redhat.com>
Instead of bdrv_getlength().
Commit 57322b7 did this all over block, but one more bdrv_getlength()
has crept in since.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Benoît Canet <benoit.canet@nodalink.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vmdk.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index f000d2a..07cb62c 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -397,7 +397,7 @@ static int vmdk_add_extent(BlockDriverState *bs,
{
VmdkExtent *extent;
BDRVVmdkState *s = bs->opaque;
- int64_t length;
+ int64_t nb_sectors;
if (cluster_sectors > 0x200000) {
/* 0x200000 * 512Bytes = 1GB for one cluster is unrealistic */
@@ -413,9 +413,9 @@ static int vmdk_add_extent(BlockDriverState *bs,
return -EFBIG;
}
- length = bdrv_getlength(file);
- if (length < 0) {
- return length;
+ nb_sectors = bdrv_nb_sectors(file);
+ if (nb_sectors < 0) {
+ return nb_sectors;
}
s->extents = g_renew(VmdkExtent, s->extents, s->num_extents + 1);
@@ -432,8 +432,7 @@ static int vmdk_add_extent(BlockDriverState *bs,
extent->l1_entry_sectors = l2_size * cluster_sectors;
extent->l2_size = l2_size;
extent->cluster_sectors = flat ? sectors : cluster_sectors;
- extent->next_cluster_sector =
- ROUND_UP(DIV_ROUND_UP(length, BDRV_SECTOR_SIZE), cluster_sectors);
+ extent->next_cluster_sector = ROUND_UP(nb_sectors, cluster_sectors);
if (s->num_extents > 1) {
extent->end_sector = (*(extent - 1)).end_sector + extent->sectors;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 28/29] qemu-img: Allow source cache mode specification
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (26 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 27/29] vmdk: Use bdrv_nb_sectors() where sectors, not bytes are wanted Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 29/29] qemu-img: Allow cache mode specification for amend Kevin Wolf
` (2 subsequent siblings)
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
Many qemu-img subcommands only read the source file(s) once. For these
use cases, a full write-back cache is unnecessary and mainly clutters
host cache memory. Though this is generally no concern as cache memory
is freely available and can be scaled by the host OS, it may become a
concern with thin provisioning.
For these cases, it makes sense to allow users to freely specify the
source cache mode (e.g. use no cache at all).
This commit adds a new switch (-T) for the qemu-img subcommands check,
compare, convert and rebase to specify the cache to be used for source
images (the backing file in case of rebase).
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-img-cmds.hx | 16 ++++++------
qemu-img.c | 78 ++++++++++++++++++++++++++++++++++++++++++++------------
qemu-img.texi | 14 +++++++---
3 files changed, 80 insertions(+), 28 deletions(-)
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index d029609..48df0b8 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
@@ -10,9 +10,9 @@ STEXI
ETEXI
DEF("check", img_check,
- "check [-q] [-f fmt] [--output=ofmt] [-r [leaks | all]] filename")
+ "check [-q] [-f fmt] [--output=ofmt] [-r [leaks | all]] [-T src_cache] filename")
STEXI
-@item check [-q] [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] @var{filename}
+@item check [-q] [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] [-T @var{src_cache}] @var{filename}
ETEXI
DEF("create", img_create,
@@ -28,15 +28,15 @@ STEXI
ETEXI
DEF("compare", img_compare,
- "compare [-f fmt] [-F fmt] [-p] [-q] [-s] filename1 filename2")
+ "compare [-f fmt] [-F fmt] [-T src_cache] [-p] [-q] [-s] filename1 filename2")
STEXI
-@item compare [-f @var{fmt}] [-F @var{fmt}] [-p] [-q] [-s] @var{filename1} @var{filename2}
+@item compare [-f @var{fmt}] [-F @var{fmt}] [-T @var{src_cache}] [-p] [-q] [-s] @var{filename1} @var{filename2}
ETEXI
DEF("convert", img_convert,
- "convert [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-O output_fmt] [-o options] [-s snapshot_id_or_name] [-l snapshot_param] [-S sparse_size] filename [filename2 [...]] output_filename")
+ "convert [-c] [-p] [-q] [-n] [-f fmt] [-t cache] [-T src_cache] [-O output_fmt] [-o options] [-s snapshot_id_or_name] [-l snapshot_param] [-S sparse_size] filename [filename2 [...]] output_filename")
STEXI
-@item convert [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
+@item convert [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
ETEXI
DEF("info", img_info,
@@ -58,9 +58,9 @@ STEXI
ETEXI
DEF("rebase", img_rebase,
- "rebase [-q] [-f fmt] [-t cache] [-p] [-u] -b backing_file [-F backing_fmt] filename")
+ "rebase [-q] [-f fmt] [-t cache] [-T src_cache] [-p] [-u] -b backing_file [-F backing_fmt] filename")
STEXI
-@item rebase [-q] [-f @var{fmt}] [-t @var{cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename}
+@item rebase [-q] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename}
ETEXI
DEF("resize", img_resize,
diff --git a/qemu-img.c b/qemu-img.c
index 18caa4b..df85405 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -109,6 +109,7 @@ static void QEMU_NORETURN help(void)
" 'cache' is the cache mode used to write the output disk image, the valid\n"
" options are: 'none', 'writeback' (default, except for convert), 'writethrough',\n"
" 'directsync' and 'unsafe' (default for convert)\n"
+ " 'src_cache' in contrast is the cache mode used to read input disk images\n"
" 'size' is the disk image size in bytes. Optional suffixes\n"
" 'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' (gigabyte, 1024M),\n"
" 'T' (terabyte, 1024G), 'P' (petabyte, 1024T) and 'E' (exabyte, 1024P) are\n"
@@ -591,7 +592,7 @@ static int img_check(int argc, char **argv)
{
int c, ret;
OutputFormat output_format = OFORMAT_HUMAN;
- const char *filename, *fmt, *output;
+ const char *filename, *fmt, *output, *cache;
BlockDriverState *bs;
int fix = 0;
int flags = BDRV_O_FLAGS | BDRV_O_CHECK;
@@ -600,6 +601,7 @@ static int img_check(int argc, char **argv)
fmt = NULL;
output = NULL;
+ cache = BDRV_DEFAULT_CACHE;
for(;;) {
int option_index = 0;
static const struct option long_options[] = {
@@ -609,7 +611,7 @@ static int img_check(int argc, char **argv)
{"output", required_argument, 0, OPTION_OUTPUT},
{0, 0, 0, 0}
};
- c = getopt_long(argc, argv, "f:hr:q",
+ c = getopt_long(argc, argv, "hf:r:T:q",
long_options, &option_index);
if (c == -1) {
break;
@@ -637,6 +639,9 @@ static int img_check(int argc, char **argv)
case OPTION_OUTPUT:
output = optarg;
break;
+ case 'T':
+ cache = optarg;
+ break;
case 'q':
quiet = true;
break;
@@ -656,6 +661,12 @@ static int img_check(int argc, char **argv)
return 1;
}
+ ret = bdrv_parse_cache_flags(cache, &flags);
+ if (ret < 0) {
+ error_report("Invalid source cache option: %s", cache);
+ return 1;
+ }
+
bs = bdrv_new_open("image", filename, fmt, flags, true, quiet);
if (!bs) {
return 1;
@@ -948,7 +959,7 @@ static int check_empty_sectors(BlockDriverState *bs, int64_t sect_num,
*/
static int img_compare(int argc, char **argv)
{
- const char *fmt1 = NULL, *fmt2 = NULL, *filename1, *filename2;
+ const char *fmt1 = NULL, *fmt2 = NULL, *cache, *filename1, *filename2;
BlockDriverState *bs1, *bs2;
int64_t total_sectors1, total_sectors2;
uint8_t *buf1 = NULL, *buf2 = NULL;
@@ -956,14 +967,16 @@ static int img_compare(int argc, char **argv)
int allocated1, allocated2;
int ret = 0; /* return value - 0 Ident, 1 Different, >1 Error */
bool progress = false, quiet = false, strict = false;
+ int flags;
int64_t total_sectors;
int64_t sector_num = 0;
int64_t nb_sectors;
int c, pnum;
uint64_t progress_base;
+ cache = BDRV_DEFAULT_CACHE;
for (;;) {
- c = getopt(argc, argv, "hpf:F:sq");
+ c = getopt(argc, argv, "hf:F:T:pqs");
if (c == -1) {
break;
}
@@ -978,6 +991,9 @@ static int img_compare(int argc, char **argv)
case 'F':
fmt2 = optarg;
break;
+ case 'T':
+ cache = optarg;
+ break;
case 'p':
progress = true;
break;
@@ -1002,17 +1018,25 @@ static int img_compare(int argc, char **argv)
filename1 = argv[optind++];
filename2 = argv[optind++];
+ flags = BDRV_O_FLAGS;
+ ret = bdrv_parse_cache_flags(cache, &flags);
+ if (ret < 0) {
+ error_report("Invalid source cache option: %s", cache);
+ ret = 2;
+ goto out3;
+ }
+
/* Initialize before goto out */
qemu_progress_init(progress, 2.0);
- bs1 = bdrv_new_open("image 1", filename1, fmt1, BDRV_O_FLAGS, true, quiet);
+ bs1 = bdrv_new_open("image 1", filename1, fmt1, flags, true, quiet);
if (!bs1) {
error_report("Can't open file %s", filename1);
ret = 2;
goto out3;
}
- bs2 = bdrv_new_open("image 2", filename2, fmt2, BDRV_O_FLAGS, true, quiet);
+ bs2 = bdrv_new_open("image 2", filename2, fmt2, flags, true, quiet);
if (!bs2) {
error_report("Can't open file %s", filename2);
ret = 2;
@@ -1191,8 +1215,8 @@ static int img_convert(int argc, char **argv)
{
int c, n, n1, bs_n, bs_i, compress, cluster_sectors, skip_create;
int64_t ret = 0;
- int progress = 0, flags;
- const char *fmt, *out_fmt, *cache, *out_baseimg, *out_filename;
+ int progress = 0, flags, src_flags;
+ const char *fmt, *out_fmt, *cache, *src_cache, *out_baseimg, *out_filename;
BlockDriver *drv, *proto_drv;
BlockDriverState **bs = NULL, *out_bs = NULL;
int64_t total_sectors, nb_sectors, sector_num, bs_offset;
@@ -1214,11 +1238,12 @@ static int img_convert(int argc, char **argv)
fmt = NULL;
out_fmt = "raw";
cache = "unsafe";
+ src_cache = BDRV_DEFAULT_CACHE;
out_baseimg = NULL;
compress = 0;
skip_create = 0;
for(;;) {
- c = getopt(argc, argv, "f:O:B:s:hce6o:pS:t:qnl:");
+ c = getopt(argc, argv, "hf:O:B:ce6o:s:l:S:pt:T:qn");
if (c == -1) {
break;
}
@@ -1299,6 +1324,9 @@ static int img_convert(int argc, char **argv)
case 't':
cache = optarg;
break;
+ case 'T':
+ src_cache = optarg;
+ break;
case 'q':
quiet = true;
break;
@@ -1335,6 +1363,13 @@ static int img_convert(int argc, char **argv)
goto out;
}
+ src_flags = BDRV_O_FLAGS;
+ ret = bdrv_parse_cache_flags(src_cache, &src_flags);
+ if (ret < 0) {
+ error_report("Invalid source cache option: %s", src_cache);
+ goto out;
+ }
+
qemu_progress_print(0, 100);
bs = g_new0(BlockDriverState *, bs_n);
@@ -1344,7 +1379,7 @@ static int img_convert(int argc, char **argv)
for (bs_i = 0; bs_i < bs_n; bs_i++) {
char *id = bs_n > 1 ? g_strdup_printf("source %d", bs_i)
: g_strdup("source");
- bs[bs_i] = bdrv_new_open(id, argv[optind + bs_i], fmt, BDRV_O_FLAGS,
+ bs[bs_i] = bdrv_new_open(id, argv[optind + bs_i], fmt, src_flags,
true, quiet);
g_free(id);
if (!bs[bs_i]) {
@@ -2291,8 +2326,8 @@ static int img_rebase(int argc, char **argv)
BlockDriverState *bs, *bs_old_backing = NULL, *bs_new_backing = NULL;
BlockDriver *old_backing_drv, *new_backing_drv;
char *filename;
- const char *fmt, *cache, *out_basefmt, *out_baseimg;
- int c, flags, ret;
+ const char *fmt, *cache, *src_cache, *out_basefmt, *out_baseimg;
+ int c, flags, src_flags, ret;
int unsafe = 0;
int progress = 0;
bool quiet = false;
@@ -2301,10 +2336,11 @@ static int img_rebase(int argc, char **argv)
/* Parse commandline parameters */
fmt = NULL;
cache = BDRV_DEFAULT_CACHE;
+ src_cache = BDRV_DEFAULT_CACHE;
out_baseimg = NULL;
out_basefmt = NULL;
for(;;) {
- c = getopt(argc, argv, "uhf:F:b:pt:q");
+ c = getopt(argc, argv, "hf:F:b:upt:T:q");
if (c == -1) {
break;
}
@@ -2331,6 +2367,9 @@ static int img_rebase(int argc, char **argv)
case 't':
cache = optarg;
break;
+ case 'T':
+ src_cache = optarg;
+ break;
case 'q':
quiet = true;
break;
@@ -2359,6 +2398,13 @@ static int img_rebase(int argc, char **argv)
return -1;
}
+ src_flags = BDRV_O_FLAGS;
+ ret = bdrv_parse_cache_flags(src_cache, &src_flags);
+ if (ret < 0) {
+ error_report("Invalid source cache option: %s", src_cache);
+ return -1;
+ }
+
/*
* Open the images.
*
@@ -2402,7 +2448,7 @@ static int img_rebase(int argc, char **argv)
bs_old_backing = bdrv_new("old_backing", &error_abort);
bdrv_get_backing_filename(bs, backing_name, sizeof(backing_name));
- ret = bdrv_open(&bs_old_backing, backing_name, NULL, NULL, BDRV_O_FLAGS,
+ ret = bdrv_open(&bs_old_backing, backing_name, NULL, NULL, src_flags,
old_backing_drv, &local_err);
if (ret) {
error_report("Could not open old backing file '%s': %s",
@@ -2412,8 +2458,8 @@ static int img_rebase(int argc, char **argv)
}
if (out_baseimg[0]) {
bs_new_backing = bdrv_new("new_backing", &error_abort);
- ret = bdrv_open(&bs_new_backing, out_baseimg, NULL, NULL,
- BDRV_O_FLAGS, new_backing_drv, &local_err);
+ ret = bdrv_open(&bs_new_backing, out_baseimg, NULL, NULL, src_flags,
+ new_backing_drv, &local_err);
if (ret) {
error_report("Could not open new backing file '%s': %s",
out_baseimg, error_get_pretty(local_err));
diff --git a/qemu-img.texi b/qemu-img.texi
index 514be90..688b28d 100644
--- a/qemu-img.texi
+++ b/qemu-img.texi
@@ -72,6 +72,9 @@ down to the nearest 512 bytes. You may use the common size suffixes like
specifies the cache mode that should be used with the (destination) file. See
the documentation of the emulator's @code{-drive cache=...} option for allowed
values.
+@item -T @var{src_cache}
+in contrast specifies the cache mode that should be used with the source
+file(s).
@end table
Parameters to snapshot subcommand:
@@ -113,7 +116,7 @@ Skip the creation of the target volume
Command description:
@table @option
-@item check [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] @var{filename}
+@item check [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] [-T @var{src_cache}] @var{filename}
Perform a consistency check on the disk image @var{filename}. The command can
output in the format @var{ofmt} which is either @code{human} or @code{json}.
@@ -172,7 +175,7 @@ the backing file, the backing file will not be truncated. If you want the
backing file to match the size of the smaller snapshot, you can safely truncate
it yourself once the commit operation successfully completes.
-@item compare [-f @var{fmt}] [-F @var{fmt}] [-p] [-s] [-q] @var{filename1} @var{filename2}
+@item compare [-f @var{fmt}] [-F @var{fmt}] [-T @var{src_cache}] [-p] [-s] [-q] @var{filename1} @var{filename2}
Check if two images have the same content. You can compare images with
different format or settings.
@@ -213,7 +216,7 @@ Error on reading data
@end table
-@item convert [-c] [-p] [-n] [-f @var{fmt}] [-t @var{cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
+@item convert [-c] [-p] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
Convert the disk image @var{filename} or a snapshot @var{snapshot_param}(@var{snapshot_id_or_name} is deprecated)
to disk image @var{output_filename} using format @var{output_fmt}. It can be optionally compressed (@code{-c}
@@ -325,7 +328,7 @@ source code.
List, apply, create or delete snapshots in image @var{filename}.
-@item rebase [-f @var{fmt}] [-t @var{cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename}
+@item rebase [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename}
Changes the backing file of an image. Only the formats @code{qcow2} and
@code{qed} support changing the backing file.
@@ -336,6 +339,9 @@ The backing file is changed to @var{backing_file} and (if the image format of
string), then the image is rebased onto no backing file (i.e. it will exist
independently of any backing file).
+@var{cache} specifies the cache mode to be used for @var{filename}, whereas
+@var{src_cache} specifies the cache mode for reading the new backing file.
+
There are two different modes in which @code{rebase} can operate:
@table @option
@item Safe mode
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 29/29] qemu-img: Allow cache mode specification for amend
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (27 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 28/29] qemu-img: Allow source cache mode specification Kevin Wolf
@ 2014-08-22 14:51 ` Kevin Wolf
2014-08-22 15:09 ` [Qemu-devel] [PULL 00/29] Block patches Daniel H Barboza
2014-08-22 16:23 ` Peter Maydell
30 siblings, 0 replies; 38+ messages in thread
From: Kevin Wolf @ 2014-08-22 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
From: Max Reitz <mreitz@redhat.com>
qemu-img amend may extensively modify the target image, depending on the
options to be amended (e.g. conversion to qcow2 compat level 0.10 from
1.1 for an image with many unallocated zero clusters). Therefore it
makes sense to allow the user to specify the cache mode to be used.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-img-cmds.hx | 4 ++--
qemu-img.c | 19 +++++++++++++++----
qemu-img.texi | 2 +-
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index 48df0b8..55aec6b 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
@@ -70,8 +70,8 @@ STEXI
ETEXI
DEF("amend", img_amend,
- "amend [-q] [-f fmt] -o options filename")
+ "amend [-q] [-f fmt] [-t cache] -o options filename")
STEXI
-@item amend [-q] [-f @var{fmt}] -o @var{options} @var{filename}
+@item amend [-q] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename}
@end table
ETEXI
diff --git a/qemu-img.c b/qemu-img.c
index df85405..c843420 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2778,12 +2778,14 @@ static int img_amend(int argc, char **argv)
char *options = NULL;
QemuOptsList *create_opts = NULL;
QemuOpts *opts = NULL;
- const char *fmt = NULL, *filename;
+ const char *fmt = NULL, *filename, *cache;
+ int flags;
bool quiet = false;
BlockDriverState *bs = NULL;
+ cache = BDRV_DEFAULT_CACHE;
for (;;) {
- c = getopt(argc, argv, "hqf:o:");
+ c = getopt(argc, argv, "ho:f:t:q");
if (c == -1) {
break;
}
@@ -2810,6 +2812,9 @@ static int img_amend(int argc, char **argv)
case 'f':
fmt = optarg;
break;
+ case 't':
+ cache = optarg;
+ break;
case 'q':
quiet = true;
break;
@@ -2832,8 +2837,14 @@ static int img_amend(int argc, char **argv)
error_exit("Expecting one image file name");
}
- bs = bdrv_new_open("image", filename, fmt,
- BDRV_O_FLAGS | BDRV_O_RDWR, true, quiet);
+ flags = BDRV_O_FLAGS | BDRV_O_RDWR;
+ ret = bdrv_parse_cache_flags(cache, &flags);
+ if (ret < 0) {
+ error_report("Invalid cache option: %s", cache);
+ goto out;
+ }
+
+ bs = bdrv_new_open("image", filename, fmt, flags, true, quiet);
if (!bs) {
error_report("Could not open image '%s'", filename);
ret = -1;
diff --git a/qemu-img.texi b/qemu-img.texi
index 688b28d..cb68948 100644
--- a/qemu-img.texi
+++ b/qemu-img.texi
@@ -397,7 +397,7 @@ After using this command to grow a disk image, you must use file system and
partitioning tools inside the VM to actually begin using the new space on the
device.
-@item amend [-f @var{fmt}] -o @var{options} @var{filename}
+@item amend [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename}
Amends the image format specific @var{options} for the image file
@var{filename}. Not all file formats support this operation.
--
1.8.3.1
^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [PULL 00/29] Block patches
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (28 preceding siblings ...)
2014-08-22 14:51 ` [Qemu-devel] [PULL 29/29] qemu-img: Allow cache mode specification for amend Kevin Wolf
@ 2014-08-22 15:09 ` Daniel H Barboza
2014-08-22 16:23 ` Peter Maydell
30 siblings, 0 replies; 38+ messages in thread
From: Daniel H Barboza @ 2014-08-22 15:09 UTC (permalink / raw)
To: Kevin Wolf, qemu-devel
Any change of getting this patch pulled in this batch?
"[PATCH v3] block.curl: adding 'timeout' option"
Thanks
On 08/22/2014 11:51 AM, Kevin Wolf wrote:
> The following changes since commit 302fa283789a2f9b1199c327047cfad2258a23a2:
>
> Revert "memory: Use canonical path component as the name" (2014-08-19 20:05:46 +0100)
>
> are available in the git repository at:
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to bd39e6ed0b88a1473c652c97e731a156cccf16e2:
>
> qemu-img: Allow cache mode specification for amend (2014-08-22 14:54:48 +0200)
>
> ----------------------------------------------------------------
> Block patches
>
> ----------------------------------------------------------------
> Fam Zheng (1):
> blkdebug: Delete BH in bdrv_aio_cancel
>
> Kevin Wolf (1):
> qemu-iotests: Fix 028 reference output for qed
>
> Maria Kustova (2):
> runner: Add an argument for test duration
> runner: Kill a program under test by time-out
>
> Markus Armbruster (5):
> block: Use g_new() & friends where that makes obvious sense
> block: Use g_new() & friends to avoid multiplying sizes
> qemu-io-cmds: g_renew() can't fail, bury dead error handling
> block: Drop some superfluous casts from void *
> vmdk: Use bdrv_nb_sectors() where sectors, not bytes are wanted
>
> Max Reitz (12):
> qcow2: Constant cache size in bytes
> qcow2: Use g_try_new0() for cache array
> qcow2: Add runtime options for cache sizes
> iotests: Add test for qcow2's cache options
> block: Add bdrv_refresh_filename()
> blkdebug: Implement bdrv_refresh_filename()
> blkverify: Implement bdrv_refresh_filename()
> nbd: Implement bdrv_refresh_filename()
> quorum: Implement bdrv_refresh_filename()
> iotests: Add test for image filename construction
> qemu-img: Allow source cache mode specification
> qemu-img: Allow cache mode specification for amend
>
> Michael Tokarev (1):
> block/vvfat.c: remove debugging code to reinit stderr if NULL
>
> Ming Lei (1):
> test-coroutine: test cost introduced by coroutine
>
> Peter Lieven (1):
> block/iscsi: fix memory corruption on iscsi resize
>
> Stefan Hajnoczi (4):
> block: acquire AioContext in qmp_block_resize()
> virtio-blk: allow block_resize with dataplane
> raw-posix: fix O_DIRECT short reads
> qemu-iotests: add test case 101 for short file I/O
>
> zhanghailiang (1):
> virtio-blk: fix reference a pointer which might be freed
>
> block-migration.c | 6 +-
> block.c | 149 +++++++++++++++++++++++++++++++++++++--
> block/archipelago.c | 6 +-
> block/blkdebug.c | 101 ++++++++++++++++++++++++++
> block/blkverify.c | 29 ++++++++
> block/bochs.c | 2 +-
> block/gluster.c | 8 +--
> block/iscsi.c | 5 +-
> block/nbd.c | 36 ++++++++++
> block/nfs.c | 2 +-
> block/parallels.c | 2 +-
> block/qcow.c | 2 +-
> block/qcow2-cache.c | 13 ++--
> block/qcow2-cluster.c | 2 +-
> block/qcow2-refcount.c | 8 +--
> block/qcow2-snapshot.c | 8 +--
> block/qcow2.c | 120 ++++++++++++++++++++++++++++---
> block/qcow2.h | 13 +++-
> block/qed-check.c | 3 +-
> block/quorum.c | 39 ++++++++++
> block/raw-posix.c | 11 ++-
> block/rbd.c | 6 +-
> block/sheepdog.c | 6 +-
> block/vdi.c | 2 +-
> block/vhdx-log.c | 2 +-
> block/vhdx.c | 4 +-
> block/vmdk.c | 18 +++--
> block/vvfat.c | 19 ++---
> blockdev-nbd.c | 2 +-
> blockdev.c | 15 ++--
> hw/block/dataplane/virtio-blk.c | 1 +
> hw/block/nvme.c | 8 +--
> hw/block/virtio-blk.c | 3 +-
> hw/ide/ahci.c | 2 +-
> hw/ide/microdrive.c | 2 +-
> include/block/block.h | 1 +
> include/block/block_int.h | 6 ++
> qemu-img-cmds.hx | 20 +++---
> qemu-img.c | 97 +++++++++++++++++++------
> qemu-img.texi | 16 +++--
> qemu-io-cmds.c | 21 ++----
> qemu-io.c | 2 +-
> tests/image-fuzzer/runner.py | 50 ++++++++++---
> tests/qemu-iotests/028 | 1 +
> tests/qemu-iotests/028.out | 3 +-
> tests/qemu-iotests/099 | 116 ++++++++++++++++++++++++++++++
> tests/qemu-iotests/099.out | 20 ++++++
> tests/qemu-iotests/101 | 58 +++++++++++++++
> tests/qemu-iotests/101.out | 10 +++
> tests/qemu-iotests/103 | 99 ++++++++++++++++++++++++++
> tests/qemu-iotests/103.out | 29 ++++++++
> tests/qemu-iotests/common.filter | 22 ++++++
> tests/qemu-iotests/common.rc | 19 +----
> tests/qemu-iotests/group | 3 +
> tests/test-coroutine.c | 30 ++++++++
> 55 files changed, 1103 insertions(+), 175 deletions(-)
> create mode 100755 tests/qemu-iotests/099
> create mode 100644 tests/qemu-iotests/099.out
> create mode 100755 tests/qemu-iotests/101
> create mode 100644 tests/qemu-iotests/101.out
> create mode 100755 tests/qemu-iotests/103
> create mode 100644 tests/qemu-iotests/103.out
>
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [PULL 00/29] Block patches
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
` (29 preceding siblings ...)
2014-08-22 15:09 ` [Qemu-devel] [PULL 00/29] Block patches Daniel H Barboza
@ 2014-08-22 16:23 ` Peter Maydell
30 siblings, 0 replies; 38+ messages in thread
From: Peter Maydell @ 2014-08-22 16:23 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers
On 22 August 2014 15:51, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit 302fa283789a2f9b1199c327047cfad2258a23a2:
>
> Revert "memory: Use canonical path component as the name" (2014-08-19 20:05:46 +0100)
>
> are available in the git repository at:
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to bd39e6ed0b88a1473c652c97e731a156cccf16e2:
>
> qemu-img: Allow cache mode specification for amend (2014-08-22 14:54:48 +0200)
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 00/29] Block patches
@ 2016-03-17 15:56 Kevin Wolf
2016-03-17 16:46 ` Peter Maydell
0 siblings, 1 reply; 38+ messages in thread
From: Kevin Wolf @ 2016-03-17 15:56 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, qemu-devel
The following changes since commit 331ac65963ab74dd84659b748affa0b111486f06:
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2016-03-17 11:27:54 +0000)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 361dca7a5a05d93ddbe696069f54d3d4cec41c8c:
Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-03-17-v2' into queue-block (2016-03-17 16:48:49 +0100)
----------------------------------------------------------------
Block layer patches
----------------------------------------------------------------
Alberto Garcia (2):
quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode
iotests: Test QUORUM_REPORT_BAD in fifo mode
Kevin Wolf (11):
block: Fix qemu_root_bds_opts.head initialisation
block: Fix memory leak in hmp_drive_add_node()
block: Use BdrvChild in BlockBackend
block: Use blk_co_preadv() for blk_read()
block: Use blk_co_pwritev() for blk_write()
block: Pull up blk_read_unthrottled() implementation
block: Use blk_co_pwritev() in blk_write_zeroes()
block: Use blk_prw() in blk_pread()/blk_pwrite()
block: Use blk_aio_prwv() for aio_read/write/write_zeroes
block: Use blk_co_pwritev() in blk_co_write_zeroes()
Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-03-17-v2' into queue-block
Max Reitz (17):
monitor: Use BB list for BB name completion
block: Use blk_next() in block-backend.c
block: Add blk_commit_all()
block: Use blk_{commit,flush}_all() consistently
qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATURE
block: Drop BB name from bad option error
blockdev: Rename blk_backends
blockdev: Add list of all BlockBackends
blockdev: Separate BB name management
blockdev: Split monitor reference from BB creation
blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del()
block: Move some bdrv_*_all() functions to BB
block: Add bdrv_next_monitor_owned()
block: Add blk_next_root_bs()
block: Rewrite bdrv_next()
block: Use bdrv_next() instead of bdrv_states
block: Remove bdrv_states list
block.c | 133 +++--
block/block-backend.c | 706 ++++++++++++++++++--------
block/io.c | 44 +-
block/parallels.c | 2 +-
block/qcow.c | 8 +-
block/qcow2.c | 30 +-
block/qed.c | 9 +-
block/quorum.c | 17 +-
block/sheepdog.c | 4 +-
block/vdi.c | 2 +-
block/vhdx.c | 2 +-
block/vmdk.c | 13 +-
block/vpc.c | 2 +-
blockdev.c | 47 +-
cpus.c | 5 +-
device-hotplug.c | 4 +-
hw/block/xen_disk.c | 2 +-
include/block/block.h | 6 +-
include/block/block_int.h | 16 +-
include/qapi/qmp/qerror.h | 3 -
include/sysemu/block-backend.h | 15 +-
monitor.c | 7 +-
qemu-char.c | 3 +-
qemu-img.c | 50 +-
qemu-io.c | 2 +-
qemu-nbd.c | 4 +-
stubs/Makefile.objs | 3 +-
stubs/bdrv-next-monitor-owned.c | 8 +
stubs/{bdrv-commit-all.c => blk-commit-all.c} | 4 +-
tests/qemu-iotests/036.out | 16 +-
tests/qemu-iotests/051.out | 8 +-
tests/qemu-iotests/051.pc.out | 8 +-
tests/qemu-iotests/087.out | 2 +-
tests/qemu-iotests/148 | 17 +-
tests/qemu-iotests/148.out | 4 +-
35 files changed, 736 insertions(+), 470 deletions(-)
create mode 100644 stubs/bdrv-next-monitor-owned.c
rename stubs/{bdrv-commit-all.c => blk-commit-all.c} (53%)
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [PULL 00/29] Block patches
2016-03-17 15:56 Kevin Wolf
@ 2016-03-17 16:46 ` Peter Maydell
0 siblings, 0 replies; 38+ messages in thread
From: Peter Maydell @ 2016-03-17 16:46 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers, Qemu-block
On 17 March 2016 at 15:56, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit 331ac65963ab74dd84659b748affa0b111486f06:
>
> Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2016-03-17 11:27:54 +0000)
>
> are available in the git repository at:
>
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 361dca7a5a05d93ddbe696069f54d3d4cec41c8c:
>
> Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-03-17-v2' into queue-block (2016-03-17 16:48:49 +0100)
>
> ----------------------------------------------------------------
>
> Block layer patches
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 38+ messages in thread
* [Qemu-devel] [PULL 00/29] Block patches
@ 2018-06-11 14:25 Max Reitz
2018-06-11 15:20 ` Peter Maydell
0 siblings, 1 reply; 38+ messages in thread
From: Max Reitz @ 2018-06-11 14:25 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, Max Reitz, Kevin Wolf, Peter Maydell
The following changes since commit 9f55925b8f50a962d1d08d815044db7767ae3838:
Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-3.0-pull-request' into staging (2018-06-11 12:46:16 +0100)
are available in the Git repository at:
git://github.com/XanClic/qemu.git tags/pull-block-2018-06-11
for you to fetch changes up to c50abd175a88cd41c2c08339de91f6f6e4a7b162:
iotests: Add case for a corrupted inactive image (2018-06-11 16:18:45 +0200)
----------------------------------------------------------------
Block patches:
- Various bug fixes
- Removal of qemu-img convert's deprecated -s option
- qemu-io now exits with an error when a command failed
----------------------------------------------------------------
Alberto Garcia (1):
throttle: Fix crash on reopen
Max Reitz (25):
block/file-posix: Pass FD to locking helpers
block/file-posix: File locking during creation
iotests: Add creation test to 153
qemu-img: Amendment support implies create_opts
block: Add Error parameter to bdrv_amend_options
qemu-option: Pull out "Supported options" print
qemu-img: Add print_amend_option_help()
qemu-img: Recognize no creation support in -o help
iotests: Test help option for unsupporting formats
iotests: Rework 113
qcow2: Repair OFLAG_COPIED when fixing leaks
iotests: Repairing error during snapshot deletion
qemu-io: Drop command functions' return values
qemu-io: Let command functions return error code
qemu-io: Exit with error when a command failed
iotests.py: Add qemu_io_silent
iotests: Let 216 make use of qemu-io's exit code
qemu-img: Resolve relative backing paths in rebase
iotests: Add test for rebasing with relative paths
qemu-img: Special post-backing convert handling
iotests: Test post-backing convert target behavior
iotests: Fix 219's timing
block: Make bdrv_is_writable() public
qcow2: Do not mark inactive images corrupt
iotests: Add case for a corrupted inactive image
Thomas Huth (1):
qemu-img: Remove deprecated -s snapshot_id_or_name option
Vladimir Sementsov-Ogievskiy (2):
iotests: improve pause_job
block/qcow2-bitmap: fix free_bitmap_clusters
include/block/block.h | 4 +-
include/block/block_int.h | 3 +-
include/qemu-io.h | 9 +-
block.c | 25 ++-
block/file-posix.c | 64 ++++++--
block/qcow2-bitmap.c | 1 -
block/qcow2-refcount.c | 25 ++-
block/qcow2.c | 74 +++++----
block/throttle.c | 54 ++++---
qemu-img.c | 108 +++++++++++--
qemu-io-cmds.c | 276 +++++++++++++++++++---------------
qemu-io.c | 62 +++++---
util/qemu-option.c | 1 -
qemu-doc.texi | 7 -
qemu-img-cmds.hx | 4 +-
qemu-img.texi | 7 +-
tests/qemu-iotests/024 | 82 +++++++++-
tests/qemu-iotests/024.out | 30 ++++
tests/qemu-iotests/029 | 2 +-
tests/qemu-iotests/060 | 30 ++++
tests/qemu-iotests/060.out | 18 ++-
tests/qemu-iotests/061.out | 7 -
tests/qemu-iotests/080 | 4 +-
tests/qemu-iotests/080.out | 4 +-
tests/qemu-iotests/082 | 9 ++
tests/qemu-iotests/082.out | 53 ++++---
tests/qemu-iotests/112.out | 5 +-
tests/qemu-iotests/113 | 19 ++-
tests/qemu-iotests/113.out | 7 +-
tests/qemu-iotests/122 | 42 ++++++
tests/qemu-iotests/122.out | 18 +++
tests/qemu-iotests/153 | 18 +++
tests/qemu-iotests/153.out | 13 ++
tests/qemu-iotests/216 | 23 +--
tests/qemu-iotests/216.out | 17 +--
tests/qemu-iotests/217 | 90 +++++++++++
tests/qemu-iotests/217.out | 42 ++++++
tests/qemu-iotests/219 | 26 +++-
tests/qemu-iotests/219.out | 10 +-
tests/qemu-iotests/group | 1 +
tests/qemu-iotests/iotests.py | 18 ++-
41 files changed, 970 insertions(+), 342 deletions(-)
create mode 100755 tests/qemu-iotests/217
create mode 100644 tests/qemu-iotests/217.out
--
2.17.1
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [Qemu-devel] [PULL 00/29] Block patches
2018-06-11 14:25 Max Reitz
@ 2018-06-11 15:20 ` Peter Maydell
0 siblings, 0 replies; 38+ messages in thread
From: Peter Maydell @ 2018-06-11 15:20 UTC (permalink / raw)
To: Max Reitz; +Cc: Qemu-block, QEMU Developers, Kevin Wolf
On 11 June 2018 at 15:25, Max Reitz <mreitz@redhat.com> wrote:
> The following changes since commit 9f55925b8f50a962d1d08d815044db7767ae3838:
>
> Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-3.0-pull-request' into staging (2018-06-11 12:46:16 +0100)
>
> are available in the Git repository at:
>
> git://github.com/XanClic/qemu.git tags/pull-block-2018-06-11
>
> for you to fetch changes up to c50abd175a88cd41c2c08339de91f6f6e4a7b162:
>
> iotests: Add case for a corrupted inactive image (2018-06-11 16:18:45 +0200)
>
> ----------------------------------------------------------------
> Block patches:
> - Various bug fixes
> - Removal of qemu-img convert's deprecated -s option
> - qemu-io now exits with an error when a command failed
>
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2018-06-11 15:21 UTC | newest]
Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-22 14:51 [Qemu-devel] [PULL 00/29] Block patches Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 01/29] block: Use g_new() & friends where that makes obvious sense Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 02/29] block: Use g_new() & friends to avoid multiplying sizes Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 03/29] qemu-io-cmds: g_renew() can't fail, bury dead error handling Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 04/29] block: Drop some superfluous casts from void * Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 05/29] runner: Add an argument for test duration Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 06/29] runner: Kill a program under test by time-out Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 07/29] qcow2: Constant cache size in bytes Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 08/29] qcow2: Use g_try_new0() for cache array Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 09/29] qcow2: Add runtime options for cache sizes Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 10/29] iotests: Add test for qcow2's cache options Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 11/29] test-coroutine: test cost introduced by coroutine Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 12/29] qemu-iotests: Fix 028 reference output for qed Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 13/29] block: acquire AioContext in qmp_block_resize() Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 14/29] virtio-blk: allow block_resize with dataplane Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 15/29] virtio-blk: fix reference a pointer which might be freed Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 16/29] block: Add bdrv_refresh_filename() Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 17/29] blkdebug: Implement bdrv_refresh_filename() Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 18/29] blkverify: " Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 19/29] nbd: " Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 20/29] quorum: " Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 21/29] iotests: Add test for image filename construction Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 22/29] block/vvfat.c: remove debugging code to reinit stderr if NULL Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 23/29] block/iscsi: fix memory corruption on iscsi resize Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 24/29] raw-posix: fix O_DIRECT short reads Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 25/29] qemu-iotests: add test case 101 for short file I/O Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 26/29] blkdebug: Delete BH in bdrv_aio_cancel Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 27/29] vmdk: Use bdrv_nb_sectors() where sectors, not bytes are wanted Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 28/29] qemu-img: Allow source cache mode specification Kevin Wolf
2014-08-22 14:51 ` [Qemu-devel] [PULL 29/29] qemu-img: Allow cache mode specification for amend Kevin Wolf
2014-08-22 15:09 ` [Qemu-devel] [PULL 00/29] Block patches Daniel H Barboza
2014-08-22 16:23 ` Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2018-06-11 14:25 Max Reitz
2018-06-11 15:20 ` Peter Maydell
2016-03-17 15:56 Kevin Wolf
2016-03-17 16:46 ` Peter Maydell
2011-08-03 14:13 Kevin Wolf
2011-08-04 22:07 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).