From 5c98415b2a2fde5739aefe51793f969ce8bb2758 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Wed, 3 Dec 2014 14:57:22 +0100 Subject: vmdk: Fix error for JSON descriptor file names If vmdk blindly tries to use path_combine() using bs->file->filename as the base file name, this will result in a bad error message for JSON file names when calling bdrv_open(). It is better to only try bs->file->exact_filename; if that is empty, bs->file->filename will be useless for path_combine() and an error should be emitted (containing bs->file->filename because desc_file_path (which is bs->file->exact_filename) is empty). Signed-off-by: Max Reitz Reviewed-by: Fam Zheng Message-id: 1417615043-26174-2-git-send-email-mreitz@redhat.com Signed-off-by: Stefan Hajnoczi --- include/block/block.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/block/block.h b/include/block/block.h index 610be9ff04..919c8f50ef 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -401,6 +401,7 @@ void bdrv_get_full_backing_filename(BlockDriverState *bs, char *dest, size_t sz); int bdrv_is_snapshot(BlockDriverState *bs); +int path_has_protocol(const char *path); int path_is_absolute(const char *path); void path_combine(char *dest, int dest_size, const char *base_path, -- cgit v1.2.3-55-g7522 From 43c5d8f8001eb467abf091c3e2a8aca3d1e5b522 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 9 Dec 2014 15:38:04 +0800 Subject: block: Don't add trailing space in "Formating..." message Change the message printing code to output a separator for each option string before it instead of after, then we don't one more extra ' ' in the end. To update qemu-iotests output files, most of the times one would just copy the *.out.bad to *.out. With this change we will not have the space disliked by checkpatch.pl. Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Message-id: 1418110684-19528-3-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi --- block.c | 4 ++-- include/qemu/option.h | 2 +- util/qemu-option.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/block.c b/block.c index a75a99228c..4165d4265c 100644 --- a/block.c +++ b/block.c @@ -5668,8 +5668,8 @@ void bdrv_img_create(const char *filename, const char *fmt, } if (!quiet) { - printf("Formatting '%s', fmt=%s ", filename, fmt); - qemu_opts_print(opts); + printf("Formatting '%s', fmt=%s", filename, fmt); + qemu_opts_print(opts, " "); puts(""); } diff --git a/include/qemu/option.h b/include/qemu/option.h index 59bea759a2..58c0157ed5 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -124,7 +124,7 @@ QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict); void qemu_opts_absorb_qdict(QemuOpts *opts, QDict *qdict, Error **errp); typedef int (*qemu_opts_loopfunc)(QemuOpts *opts, void *opaque); -void qemu_opts_print(QemuOpts *opts); +void qemu_opts_print(QemuOpts *opts, const char *sep); int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque, int abort_on_failure); void qemu_opts_print_help(QemuOptsList *list); diff --git a/util/qemu-option.c b/util/qemu-option.c index 5d106959ca..a708241643 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -737,14 +737,14 @@ void qemu_opts_del(QemuOpts *opts) g_free(opts); } -void qemu_opts_print(QemuOpts *opts) +void qemu_opts_print(QemuOpts *opts, const char *sep) { QemuOpt *opt; QemuOptDesc *desc = opts->list->desc; if (desc[0].name == NULL) { QTAILQ_FOREACH(opt, &opts->head, next) { - printf("%s=\"%s\" ", opt->name, opt->str); + printf("%s%s=\"%s\"", sep, opt->name, opt->str); } return; } @@ -757,12 +757,12 @@ void qemu_opts_print(QemuOpts *opts) continue; } if (desc->type == QEMU_OPT_STRING) { - printf("%s='%s' ", desc->name, value); + printf("%s%s='%s'", sep, desc->name, value); } else if ((desc->type == QEMU_OPT_SIZE || desc->type == QEMU_OPT_NUMBER) && opt) { - printf("%s=%" PRId64 " ", desc->name, opt->value.uint); + printf("%s%s=%" PRId64, sep, desc->name, opt->value.uint); } else { - printf("%s=%s ", desc->name, value); + printf("%s%s=%s", sep, desc->name, value); } } } -- cgit v1.2.3-55-g7522 From b5cf2c1b0897506a40e0c420391875acc484792b Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 10 Dec 2014 12:02:17 +0000 Subject: block: drop unused bdrv_clear_incoming_migration_all() prototype The bdrv_clear_incoming_migration_all() function has not existed since commit 7ea2d269cb84ca7a2f4b7c3735634176f7c1dc35 ("block/migration: Disable cache invalidate for incoming migration"). Signed-off-by: Stefan Hajnoczi Reviewed-by: Max Reitz Message-id: 1418212937-22222-1-git-send-email-stefanha@redhat.com --- include/block/block.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/block/block.h b/include/block/block.h index 919c8f50ef..6e7275d95b 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -329,8 +329,6 @@ BlockAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp); void bdrv_invalidate_cache_all(Error **errp); -void bdrv_clear_incoming_migration_all(void); - /* Ensure contents are flushed to disk. */ int bdrv_flush(BlockDriverState *bs); int coroutine_fn bdrv_co_flush(BlockDriverState *bs); -- cgit v1.2.3-55-g7522 From 82595da8dedde128d8004ec47441aeb720c08704 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 11 Dec 2014 14:52:30 +0100 Subject: linux-aio: simplify removal of completed iocbs from the list There is no need to do another O(n) pass on the list; the iocb to split the list at is already available through the array we passed to io_submit. Signed-off-by: Paolo Bonzini Reviewed-by: Kevin Wolf Message-id: 1418305950-30924-6-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi --- block/linux-aio.c | 12 ++++++------ include/qemu/queue.h | 11 +++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/block/linux-aio.c b/block/linux-aio.c index 8474378fc2..c991443c5d 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -186,9 +186,10 @@ static void ioq_init(LaioQueue *io_q) static void ioq_submit(struct qemu_laio_state *s) { - int ret, i, len; + int ret, len; struct qemu_laiocb *aiocb; struct iocb *iocbs[MAX_QUEUED_IO]; + QSIMPLEQ_HEAD(, qemu_laiocb) completed; do { len = 0; @@ -201,16 +202,15 @@ static void ioq_submit(struct qemu_laio_state *s) ret = io_submit(s->ctx, len, iocbs); if (ret == -EAGAIN) { - ret = 0; + break; } if (ret < 0) { abort(); } - for (i = 0; i < ret; i++) { - s->io_q.n--; - QSIMPLEQ_REMOVE_HEAD(&s->io_q.pending, next); - } + s->io_q.n -= ret; + aiocb = container_of(iocbs[ret - 1], struct qemu_laiocb, iocb); + QSIMPLEQ_SPLIT_AFTER(&s->io_q.pending, aiocb, next, &completed); } while (ret == len && !QSIMPLEQ_EMPTY(&s->io_q.pending)); s->io_q.blocked = (s->io_q.n > 0); } diff --git a/include/qemu/queue.h b/include/qemu/queue.h index d433b9017c..42bcadfbb1 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -268,6 +268,17 @@ struct { \ (head)->sqh_last = &(head)->sqh_first; \ } while (/*CONSTCOND*/0) +#define QSIMPLEQ_SPLIT_AFTER(head, elm, field, removed) do { \ + QSIMPLEQ_INIT(removed); \ + if (((removed)->sqh_first = (head)->sqh_first) != NULL) { \ + if (((head)->sqh_first = (elm)->field.sqe_next) == NULL) { \ + (head)->sqh_last = &(head)->sqh_first; \ + } \ + (removed)->sqh_last = &(elm)->field.sqe_next; \ + (elm)->field.sqe_next = NULL; \ + } \ +} while (/*CONSTCOND*/0) + #define QSIMPLEQ_REMOVE(head, elm, type, field) do { \ if ((head)->sqh_first == (elm)) { \ QSIMPLEQ_REMOVE_HEAD((head), field); \ -- cgit v1.2.3-55-g7522