[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 22/38] block: Prepare for NULL BDS
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v5 22/38] block: Prepare for NULL BDS |
Date: |
Wed, 7 Oct 2015 12:43:44 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 18.09.2015 um 17:22 hat Max Reitz geschrieben:
> blk_bs() will not necessarily return a non-NULL value any more (unless
> blk_is_available() is true or it can be assumed to otherwise, e.g.
> because it is called immediately after a successful blk_new_with_bs() or
> blk_new_open()).
>
> Signed-off-by: Max Reitz <address@hidden>
> @@ -1922,8 +1939,9 @@ void qmp_change_blockdev(const char *device, const char
> *filename,
> return;
> }
> bs = blk_bs(blk);
> + new_bs = !bs;
>
> - aio_context = bdrv_get_aio_context(bs);
> + aio_context = blk_get_aio_context(blk);
> aio_context_acquire(aio_context);
>
> eject_device(blk, 0, &err);
> @@ -1932,10 +1950,18 @@ void qmp_change_blockdev(const char *device, const
> char *filename,
> goto out;
> }
>
> - bdrv_flags = bdrv_is_read_only(bs) ? 0 : BDRV_O_RDWR;
> - bdrv_flags |= bdrv_is_snapshot(bs) ? BDRV_O_SNAPSHOT : 0;
> + bdrv_flags = blk_is_read_only(blk) ? 0 : BDRV_O_RDWR;
> + bdrv_flags |= blk_get_root_state(blk)->open_flags & ~BDRV_O_RDWR;
>
> - qmp_bdrv_open_encrypted(bs, filename, bdrv_flags, format, NULL, errp);
> + qmp_bdrv_open_encrypted(&bs, filename, bdrv_flags, format, NULL, &err);
> + if (err) {
> + error_propagate(errp, err);
> + } else if (new_bs) {
> + blk_insert_bs(blk, bs);
> + /* Has been sent automatically by bdrv_open() if blk_bs(blk) was not
> + * NULL */
> + blk_dev_change_media_cb(blk, true);
> + }
Was this change supposed to be in this patch? It looks like it's doing a
bit more than just fixing blk_bs() == NULL cases.
Kevin
- Re: [Qemu-devel] [PATCH v5 22/38] block: Prepare for NULL BDS,
Kevin Wolf <=