[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 08/11] migration: implement bdrv_all_find_vmstat
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 08/11] migration: implement bdrv_all_find_vmstate_bs and bdrv_unlock helpers |
Date: |
Fri, 6 Nov 2015 15:18:45 +0000 |
User-agent: |
Mutt/1.5.23 (2015-06-09) |
On Wed, Nov 04, 2015 at 08:19:39PM +0300, Denis V. Lunev wrote:
> +BlockDriverState *bdrv_all_find_vmstate_bs(void)
> +{
> + BlockDriverState *bs = NULL;
> +
> + while ((bs = bdrv_next(bs))) {
> + AioContext *ctx = bdrv_get_aio_context(bs);
> +
> + aio_context_acquire(ctx);
> + if (bdrv_can_snapshot(bs)) {
> + return bs;
This leaves AioContext acquired. If that is intentional then it must be
documented because it looks like a bug.
Normally functions that do this have an AioContext **aio_context agument
so the caller does aio_context_release() later. This way it's obvious
that the caller needs to release.
For example, see blockdev.c:find_block_job().
> + }
> + aio_context_release(ctx);
> + }
> + return NULL;
> +}
> +
> +void bdrv_unlock(BlockDriverState *bs)
> +{
> + aio_context_release(bdrv_get_aio_context(bs));
> +}
This API is weird. There is no lock function. Please do what I
mentioned above.
Another advantage of that approach is that we are 100% sure to release
the same AioContext that was acquired (even if bdrv_set_aio_context()
gets called halfway through).
signature.asc
Description: PGP signature
- Re: [Qemu-devel] [PATCH 02/11] snapshot: return error code from bdrv_snapshot_delete_by_id_or_name, (continued)
- [Qemu-devel] [PATCH 01/11] snapshot: create helper to test that block drivers supports snapshots, Denis V. Lunev, 2015/11/04
- [Qemu-devel] [PATCH 04/11] snapshot: create bdrv_all_goto_snapshot helper, Denis V. Lunev, 2015/11/04
- [Qemu-devel] [PATCH 07/11] migration: reorder processing in hmp_savevm, Denis V. Lunev, 2015/11/04
- [Qemu-devel] [PATCH 05/11] snapshot: create bdrv_all_find_snapshot helper, Denis V. Lunev, 2015/11/04
- [Qemu-devel] [PATCH 08/11] migration: implement bdrv_all_find_vmstate_bs and bdrv_unlock helpers, Denis V. Lunev, 2015/11/04
- Re: [Qemu-devel] [PATCH 08/11] migration: implement bdrv_all_find_vmstate_bs and bdrv_unlock helpers,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 09/11] migration: add missed aio_context_acquire for state writing/reading, Denis V. Lunev, 2015/11/04
- [Qemu-devel] [PATCH 06/11] migration: drop find_vmstate_bs check in hmp_delvm, Denis V. Lunev, 2015/11/04
- [Qemu-devel] [PATCH 11/11] monitor: add missed aio_context_acquire into vm_completion call, Denis V. Lunev, 2015/11/04
- [Qemu-devel] [PATCH 10/11] snapshot: create bdrv_all_create_snapshot helper, Denis V. Lunev, 2015/11/04
- Re: [Qemu-devel] [PATCH 2.5 v5 0/11] dataplane snapshot fixes, Stefan Hajnoczi, 2015/11/06