-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1
 
 iQIcBAABAgAGBQJVpcSMAAoJEL2+eyfA3jBXCScP/16/YiMOCRsiud3YLssH1fZS
 vNxUrOchkP1vWKeZ0GsVxrqtvjpmC1PQ4ZnOXmfyxUVGXJ6vla07gipBY5WkKshZ
 Slaov7mCam2GLv/QHlQmB8AtLMeYe14AXo9B52Dpq49LMjJSd8sIGkcJyP92pogk
 nztEAFA53Obs1BPXfDUGXG/CgNOe0wqFtVKTu6mlIUOqZtOpYjwSAw+3kINGbRPy
 yEa/zUa5rKUbsCP4wpZP2+hOPb74/67/7MRfIgOq5QIe7j5bs5TI7mK7c8TgsebX
 lnKKqPIihoLEti8vX9iUNB4H49uJcrQcZy96D2lmk3lvi1IMHFm+BW2OkEV8GcoC
 AOYU2xGfSZ0QVNCL7AsewNhBqQtWKBc8qWGU0nD0b7WDVjO5xZ0UMPwed+QgP0Y6
 Bn2u5wTh0xIw04+JFEW+wvvX4Sl5KiNc3ebSA4qruL5KMx7lvhBGZUS/KOK4COuO
 EfjWt5MuoimFSLHpBV/h+0fMYEoxnCSD/lWC+NqG9sVcqbDjHP4G9GvbB10FNRoF
 4e9Tz3BiIcdhJBQYNzWXnM/Zf2Z11Qmm9G4+RymjTYa4yFEKfDciDAc2ulD7pQ8i
 UWhQOut+STv4ASaRLGPbFcTBI916GNZ/Ll5CH0VFFa81k4TK6keYaJWMvYHcTOws
 hoZ+n48kLLQAxCqJ5KPC
 =CaLG
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cody/tags/jtc-for-upstream-pull-request' into staging

# gpg: Signature made Wed Jul 15 03:25:16 2015 BST using RSA key ID C0DE3057
# gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>"
# gpg:                 aka "Jeffrey Cody <jeff@codyprime.org>"
# gpg:                 aka "Jeffrey Cody <codyprime@gmail.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98  D624 BDBE 7B27 C0DE 3057

* remotes/cody/tags/jtc-for-upstream-pull-request:
  block/curl: Don't lose original error when a connection fails.
  mirror: correct buf_size
  block: keep bitmap if incremental backup job is cancelled
  blockdev: no need to drain in qmp_block_commit
  block/mirror: Sleep periodically during bitmap scanning

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-07-15 14:23:58 +01:00
commit 711dc6f36b
4 changed files with 38 additions and 10 deletions

View File

@ -431,7 +431,7 @@ static void coroutine_fn backup_run(void *opaque)
if (job->sync_bitmap) {
BdrvDirtyBitmap *bm;
if (ret < 0) {
if (ret < 0 || block_job_is_cancelled(&job->common)) {
/* Merge the successor back into the parent, delete nothing. */
bm = bdrv_reclaim_dirty_bitmap(bs, job->sync_bitmap, NULL);
assert(bm);

View File

@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu-common.h"
#include "qemu/error-report.h"
#include "block/block_int.h"
#include "qapi/qmp/qbool.h"
#include "qapi/qmp/qstring.h"
@ -298,6 +299,18 @@ static void curl_multi_check_completion(BDRVCURLState *s)
/* ACBs for successful messages get completed in curl_read_cb */
if (msg->data.result != CURLE_OK) {
int i;
static int errcount = 100;
/* Don't lose the original error message from curl, since
* it contains extra data.
*/
if (errcount > 0) {
error_report("curl: %s", state->errmsg);
if (--errcount == 0) {
error_report("curl: further errors suppressed");
}
}
for (i = 0; i < CURL_NUM_ACB; i++) {
CURLAIOCB *acb = state->acb[i];
@ -305,7 +318,7 @@ static void curl_multi_check_completion(BDRVCURLState *s)
continue;
}
acb->common.cb(acb->common.opaque, -EIO);
acb->common.cb(acb->common.opaque, -EPROTO);
qemu_aio_unref(acb);
state->acb[i] = NULL;
}

View File

@ -20,6 +20,7 @@
#define SLICE_TIME 100000000ULL /* ns */
#define MAX_IN_FLIGHT 16
#define DEFAULT_MIRROR_BUF_SIZE (10 << 20)
/* The mirroring buffer is a list of granularity-sized chunks.
* Free chunks are organized in a list.
@ -444,11 +445,23 @@ static void coroutine_fn mirror_run(void *opaque)
sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS;
mirror_free_init(s);
last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
if (!s->is_none_mode) {
/* First part, loop on the sectors and initialize the dirty bitmap. */
BlockDriverState *base = s->base;
for (sector_num = 0; sector_num < end; ) {
int64_t next = (sector_num | (sectors_per_chunk - 1)) + 1;
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
if (now - last_pause_ns > SLICE_TIME) {
last_pause_ns = now;
block_job_sleep_ns(&s->common, QEMU_CLOCK_REALTIME, 0);
}
if (block_job_is_cancelled(&s->common)) {
goto immediate_exit;
}
ret = bdrv_is_allocated_above(bs, base,
sector_num, next - sector_num, &n);
@ -467,7 +480,6 @@ static void coroutine_fn mirror_run(void *opaque)
}
bdrv_dirty_iter_init(s->dirty_bitmap, &s->hbi);
last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
for (;;) {
uint64_t delay_ns = 0;
int64_t cnt;
@ -690,6 +702,14 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
return;
}
if (buf_size < 0) {
error_setg(errp, "Invalid parameter 'buf-size'");
return;
}
if (buf_size == 0) {
buf_size = DEFAULT_MIRROR_BUF_SIZE;
}
s = block_job_create(driver, bs, speed, cb, opaque, errp);
if (!s) {
@ -703,7 +723,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
s->is_none_mode = is_none_mode;
s->base = base;
s->granularity = granularity;
s->buf_size = MAX(buf_size, granularity);
s->buf_size = ROUND_UP(buf_size, granularity);
s->unmap = unmap;
s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp);

View File

@ -2380,9 +2380,6 @@ void qmp_block_commit(const char *device,
aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
/* drain all i/o before commits */
bdrv_drain_all();
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_COMMIT_SOURCE, errp)) {
goto out;
}
@ -2642,8 +2639,6 @@ out:
aio_context_release(aio_context);
}
#define DEFAULT_MIRROR_BUF_SIZE (10 << 20)
void qmp_drive_mirror(const char *device, const char *target,
bool has_format, const char *format,
bool has_node_name, const char *node_name,
@ -2685,7 +2680,7 @@ void qmp_drive_mirror(const char *device, const char *target,
granularity = 0;
}
if (!has_buf_size) {
buf_size = DEFAULT_MIRROR_BUF_SIZE;
buf_size = 0;
}
if (!has_unmap) {
unmap = true;