Commit 5ea8ec2f authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2019-07-15' into staging



Block patches for 4.1-rc1:
- Fixes for the NVMe block driver, the gluster block driver, and for
  running multiple block jobs concurrently on a single chain

# gpg: Signature made Mon 15 Jul 2019 14:51:43 BST
# gpg:                using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
# gpg:                issuer "mreitz@redhat.com"
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* remotes/maxreitz/tags/pull-block-2019-07-15:
  gluster: fix .bdrv_reopen_prepare when backing file is a JSON object
  iotests: Add read-only test case to 030
  iotests: Add new case to 030
  iotests: Add @use_log to VM.run_job()
  iotests: Compare error messages in 030
  iotests: Fix throttling in 030
  block: Deep-clear inherits_from
  block/stream: Swap backing file change order
  block/stream: Fix error path
  block: Add BDS.never_freeze
  nvme: Set number of queues later in nvme_init()

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents a68725f9 0b1847bb
Loading
Loading
Loading
Loading
+32 −10
Original line number Diff line number Diff line
@@ -2472,18 +2472,20 @@ void bdrv_root_unref_child(BdrvChild *child)
    bdrv_unref(child_bs);
}

void bdrv_unref_child(BlockDriverState *parent, BdrvChild *child)
/**
 * Clear all inherits_from pointers from children and grandchildren of
 * @root that point to @root, where necessary.
 */
static void bdrv_unset_inherits_from(BlockDriverState *root, BdrvChild *child)
{
    if (child == NULL) {
        return;
    }

    if (child->bs->inherits_from == parent) {
    BdrvChild *c;

        /* Remove inherits_from only when the last reference between parent and
         * child->bs goes away. */
        QLIST_FOREACH(c, &parent->children, next) {
    if (child->bs->inherits_from == root) {
        /*
         * Remove inherits_from only when the last reference between root and
         * child->bs goes away.
         */
        QLIST_FOREACH(c, &root->children, next) {
            if (c != child && c->bs == child->bs) {
                break;
            }
@@ -2493,6 +2495,18 @@ void bdrv_unref_child(BlockDriverState *parent, BdrvChild *child)
        }
    }

    QLIST_FOREACH(c, &child->bs->children, next) {
        bdrv_unset_inherits_from(root, c);
    }
}

void bdrv_unref_child(BlockDriverState *parent, BdrvChild *child)
{
    if (child == NULL) {
        return;
    }

    bdrv_unset_inherits_from(parent, child);
    bdrv_root_unref_child(child);
}

@@ -4416,6 +4430,14 @@ int bdrv_freeze_backing_chain(BlockDriverState *bs, BlockDriverState *base,
        return -EPERM;
    }

    for (i = bs; i != base; i = backing_bs(i)) {
        if (i->backing && backing_bs(i)->never_freeze) {
            error_setg(errp, "Cannot freeze '%s' link to '%s'",
                       i->backing->name, backing_bs(i)->node_name);
            return -EPERM;
        }
    }

    for (i = bs; i != base; i = backing_bs(i)) {
        if (i->backing) {
            i->backing->frozen = true;
+4 −0
Original line number Diff line number Diff line
@@ -298,6 +298,10 @@ void commit_start(const char *job_id, BlockDriverState *bs,
    if (!filter_node_name) {
        commit_top_bs->implicit = true;
    }

    /* So that we can always drop this node */
    commit_top_bs->never_freeze = true;

    commit_top_bs->total_sectors = top->total_sectors;

    bdrv_append(commit_top_bs, top, &local_err);
+11 −1
Original line number Diff line number Diff line
@@ -931,7 +931,17 @@ static int qemu_gluster_reopen_prepare(BDRVReopenState *state,
    gconf->has_debug = true;
    gconf->logfile = g_strdup(s->logfile);
    gconf->has_logfile = true;
    reop_s->glfs = qemu_gluster_init(gconf, state->bs->filename, NULL, errp);

    /*
     * If 'state->bs->exact_filename' is empty, 'state->options' should contain
     * the JSON parameters already parsed.
     */
    if (state->bs->exact_filename[0] != '\0') {
        reop_s->glfs = qemu_gluster_init(gconf, state->bs->exact_filename, NULL,
                                         errp);
    } else {
        reop_s->glfs = qemu_gluster_init(gconf, NULL, state->options, errp);
    }
    if (reop_s->glfs == NULL) {
        ret = -errno;
        goto exit;
+4 −0
Original line number Diff line number Diff line
@@ -1551,6 +1551,10 @@ static BlockJob *mirror_start_job(
    if (!filter_node_name) {
        mirror_top_bs->implicit = true;
    }

    /* So that we can always drop this node */
    mirror_top_bs->never_freeze = true;

    mirror_top_bs->total_sectors = bs->total_sectors;
    mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
    mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
+1 −1
Original line number Diff line number Diff line
@@ -613,12 +613,12 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,

    /* Set up admin queue. */
    s->queues = g_new(NVMeQueuePair *, 1);
    s->nr_queues = 1;
    s->queues[0] = nvme_create_queue_pair(bs, 0, NVME_QUEUE_SIZE, errp);
    if (!s->queues[0]) {
        ret = -EINVAL;
        goto out;
    }
    s->nr_queues = 1;
    QEMU_BUILD_BUG_ON(NVME_QUEUE_SIZE & 0xF000);
    s->regs->aqa = cpu_to_le32((NVME_QUEUE_SIZE << 16) | NVME_QUEUE_SIZE);
    s->regs->asq = cpu_to_le64(s->queues[0]->sq.iova);
Loading