From 0807c76e7c948a3f5be99329a3080646337f3994 Mon Sep 17 00:00:00 2001 From: Jeffrey Cody Date: Wed, 21 Mar 2012 21:54:32 +0100 Subject: [PATCH 05/55] Revert "qmp: add block_job_cancel command" RH-Author: Jeffrey Cody Message-id: <9bec92674b7f5c34e4f19e340a65adb078854598.1332362400.git.jcody@redhat.com> Patchwork-id: 38855 O-Subject: [RHEL6.3 qemu-kvm PATCH v8 05/54] Revert "qmp: add block_job_cancel command" Bugzilla: 582475 RH-Acked-by: Paolo Bonzini RH-Acked-by: Marcelo Tosatti RH-Acked-by: Kevin Wolf From: Stefan Hajnoczi This reverts commit 278a706ea66bdf334ca728191fda19b96f15d88d. Signed-off-by: Anthony Liguori Signed-off-by: Jeff Cody --- blockdev.c | 34 ---------------------------------- blockdev.h | 3 --- qemu-monitor.hx | 47 ----------------------------------------------- 3 files changed, 0 insertions(+), 84 deletions(-) Signed-off-by: Michal Novotny --- blockdev.c | 34 ---------------------------------- blockdev.h | 3 --- qemu-monitor.hx | 47 ----------------------------------------------- 3 files changed, 0 insertions(+), 84 deletions(-) diff --git a/blockdev.c b/blockdev.c index 18b3dcd..f8c1111 100644 --- a/blockdev.c +++ b/blockdev.c @@ -53,8 +53,6 @@ static const int if_max_devs[IF_COUNT] = { }; typedef struct StreamState { - MonitorCompletion *cancel_cb; - void *cancel_opaque; int64_t offset; /* current position in block device */ BlockDriverState *bs; QEMUTimer *timer; @@ -93,10 +91,6 @@ static void stream_free(StreamState *s) { QLIST_REMOVE(s, list); - if (s->cancel_cb) { - s->cancel_cb(s->cancel_opaque, NULL); - } - bdrv_set_in_use(s->bs, 0); qemu_del_timer(s->timer); qemu_free_timer(s->timer); @@ -123,8 +117,6 @@ static void stream_cb(void *opaque, int nb_sectors) if (s->offset == bdrv_getlength(s->bs)) { bdrv_change_backing_file(s->bs, NULL, NULL); stream_complete(s, 0); - } else if (s->cancel_cb) { - stream_free(s); } else { qemu_mod_timer(s->timer, qemu_get_clock(rt_clock)); } @@ -191,24 +183,6 @@ static StreamState *stream_start(const char *device) return s; } -static int stream_stop(const char *device, MonitorCompletion *cb, void *opaque) -{ - StreamState *s = stream_find(device); - - if (!s) { - qerror_report(QERR_DEVICE_NOT_ACTIVE, device); - return -1; - } - if (s->cancel_cb) { - qerror_report(QERR_DEVICE_IN_USE, device); - return -1; - } - - s->cancel_cb = cb; - s->cancel_opaque = opaque; - return 0; -} - /* * We automatically delete the drive when a device using it gets * unplugged. Questionable feature, but we can't just drop it. @@ -999,14 +973,6 @@ int do_block_stream(Monitor *mon, const QDict *params, QObject **ret_data) return stream_start(device) ? 0 : -1; } -int do_block_job_cancel(Monitor *mon, const QDict *params, - MonitorCompletion cb, void *opaque) -{ - const char *device = qdict_get_str(params, "device"); - - return stream_stop(device, cb, opaque); -} - static int eject_device(Monitor *mon, BlockDriverState *bs, int force) { if (!bdrv_dev_has_removable_media(bs)) { diff --git a/blockdev.h b/blockdev.h index 5044c14..5a6d9fc 100644 --- a/blockdev.h +++ b/blockdev.h @@ -12,7 +12,6 @@ #include "block.h" #include "qemu-queue.h" -#include "monitor.h" void blockdev_mark_auto_del(BlockDriverState *bs); void blockdev_auto_del(BlockDriverState *bs); @@ -73,7 +72,5 @@ int do_change_block(Monitor *mon, const char *device, int simple_drive_add(Monitor *mon, const QDict *qdict, QObject **ret_data); int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data); int do_block_stream(Monitor *mon, const QDict *params, QObject **ret_data); -int do_block_job_cancel(Monitor *mon, const QDict *params, - MonitorCompletion cb, void *opaque); #endif diff --git a/qemu-monitor.hx b/qemu-monitor.hx index cdcaa57..b974542 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -168,53 +168,6 @@ Examples: EQMP { - .name = "block_job_cancel", - .args_type = "device:B", - .params = "device", - .help = "Stop an active block streaming operation", - .user_print = monitor_user_noop, - .mhandler.cmd_async = do_block_job_cancel, - .flags = MONITOR_CMD_ASYNC, - }, - -STEXI -@item block_job_cancel -@findex block_job_cancel -Stop an active block streaming operation. -ETEXI -SQMP - -block_job_cancel ----------------- - -Stop an active block streaming operation. - -This command returns once the active block streaming operation has been -stopped. It is an error to call this command if no operation is in progress. - -The image file retains its backing file unless the streaming operation happens -to complete just as it is being cancelled. - -A new block streaming operation can be started at a later time to finish -copying all data from the backing file. - -Arguments: - -- device: device name (json-string) - -Errors: - -DeviceNotActive: streaming is not active on this device -DeviceInUse: cancellation already in progress - -Examples: - --> { "execute": "block_job_cancel", "arguments": { "device": "virtio0" } } -<- { "return": {} } - -EQMP - - { .name = "q|quit", .args_type = "", .params = "", -- 1.7.7.6