[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [RFC PATCH v2 2/3] block: call the snapshot handlers of
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] Re: [RFC PATCH v2 2/3] block: call the snapshot handlers of the protocol drivers |
Date: |
Fri, 14 May 2010 14:55:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4 |
Am 14.05.2010 11:51, schrieb MORITA Kazutaka:
> When snapshot handlers of the format driver is not defined, it is
> better to call the ones of the protocol driver.
>
> This enables us to implement snapshot support in the protocol driver.
>
> Signed-off-by: MORITA Kazutaka <address@hidden>
> int bdrv_snapshot_goto(BlockDriverState *bs,
> @@ -1737,9 +1743,11 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
> BlockDriver *drv = bs->drv;
> if (!drv)
> return -ENOMEDIUM;
> - if (!drv->bdrv_snapshot_goto)
> - return -ENOTSUP;
> - return drv->bdrv_snapshot_goto(bs, snapshot_id);
> + if (drv->bdrv_snapshot_goto)
> + return drv->bdrv_snapshot_goto(bs, snapshot_id);
> + if (bs->file)
> + return bdrv_snapshot_goto(bs->file, snapshot_id);
> + return -ENOTSUP;
> }
During lunch one more thing came to my mind...
For bdrv_snapshot_goto it's probably not that easy for formats other
than raw. Usually the drivers keep some state in memory, and with this
code they won't re-read it after the snapshot has been loaded - which
will lead to an inconsistent state very easily.
I think the right thing to do here is:
1. Call drv->bdrv_close() so that the format driver cleans up, but the
underlying protocol stays open
2. Load the snapshot on the protocol level
3. Call drv->bdrv_open() to load the new state
The other functions in this patch should be okay without re-opening
because they don't change the current state.
Kevin
- [Qemu-devel] Re: [RFC PATCH 1/2] close all the block drivers before the qemu process exits, (continued)
[Qemu-devel] [RFC PATCH 2/2] block: add sheepdog driver for distributed storage support, MORITA Kazutaka, 2010/05/12
Re: [Qemu-devel] [RFC PATCH 0/2] Sheepdog: distributed storage system for QEMU, Kevin Wolf, 2010/05/12
[Qemu-devel] [RFC PATCH v2 2/3] block: call the snapshot handlers of the protocol drivers, MORITA Kazutaka, 2010/05/14
- [Qemu-devel] Re: [RFC PATCH v2 2/3] block: call the snapshot handlers of the protocol drivers,
Kevin Wolf <=
[Qemu-devel] [RFC PATCH v2 1/3] close all the block drivers before the qemu process exits, MORITA Kazutaka, 2010/05/14
[Qemu-devel] [RFC PATCH v2 0/3] Sheepdog: distributed storage system for QEMU, MORITA Kazutaka, 2010/05/14
[Qemu-devel] [RFC PATCH v3 0/3] Sheepdog: distributed storage system for QEMU, MORITA Kazutaka, 2010/05/17
[Qemu-devel] [RFC PATCH v3 1/3] close all the block drivers before the qemu process exits, MORITA Kazutaka, 2010/05/17
[Qemu-devel] [RFC PATCH v3 3/3] block: add sheepdog driver for distributed storage support, MORITA Kazutaka, 2010/05/17