commit: Fix commit_top_bs problems
cover commit: Fix commit_top_bs problems
The same problem that Fam's patch "mirror: Fix aio context of mirror_top_bs" fixes for the mirror block job also exists for the commit block job and the 'commit' HMP command. While comparing the respective places in mirror.c and commit.c, I also noticed that commit neglects to set an image size.
This series fixes both problems.
Kevin Wolf (2):
commit: Set commit_top_bs->aio_context
commit: Set commit_top_bs->total_sectors
block/commit.c | 3 +++ 1 file changed, 3 insertions(+)
Signature · 1 line
1.8.3.1
PATCH 1/2 commit: Set commit_top_bs->aio_context
The filter driver that is inserted by the commit job needs to use the same AioContext as its parent and child nodes.
--- block/commit.c | 2 ++ 1 file changed, 2 insertions(+)
block/commit.c +2 -0
@@ -335,6 +335,7 @@ void commit_start(const char *job_id, BlockDriverState *bs,if (commit_top_bs ==NULL ) { goto fail; } +bdrv_set_aio_context (commit_top_bs,bdrv_get_aio_context (top));bdrv_set_backing_hd (commit_top_bs, top, &local_err);if (local_err) {
@@ -482,6 +483,7 @@ int bdrv_commit(BlockDriverState *bs)error_report_err (local_err); goto ro_cleanup; } +bdrv_set_aio_context (commit_top_bs,bdrv_get_aio_context (backing_file_bs));bdrv_set_backing_hd (commit_top_bs, backing_file_bs, &error_abort);bdrv_set_backing_hd (bs, commit_top_bs, &error_abort);
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH for-2.9 1/2] commit: Set commit_top_bs->aio_context
Quoted 8 lines · Kevin Wolf
The filter driver that is inserted by the commit job needs to use the same AioContext as its parent and child nodes.
Signed-off-by Kevin Wolf <[email protected]>--- block/commit.c | 2 ++ 1 file changed, 2 insertions(+)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
PATCH 2/2 commit: Set commit_top_bs->total_sectors
In reply to Kevin WolfLike in the mirror filter driver, we also need to set the image size for the commit filter driver. This is less likely to be a problem in practice than for the mirror because we're not at the active layer here, but attaching new parents to a node in the middle of the chain is possible, so the size needs to be correct anyway.
--- block/commit.c | 1 + 1 file changed, 1 insertion(+)
block/commit.c +1 -0
@@ -335,6 +335,7 @@ void commit_start(const char *job_id, BlockDriverState *bs,if (commit_top_bs ==NULL ) { goto fail; } + commit_top_bs->total_sectors = top->total_sectors;bdrv_set_aio_context (commit_top_bs,bdrv_get_aio_context (top));bdrv_set_backing_hd (commit_top_bs, top, &local_err);
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH for-2.9 2/2] commit: Set commit_top_bs->total_sectors
Quoted 10 lines · Kevin Wolf
Like in the mirror filter driver, we also need to set the image size for the commit filter driver. This is less likely to be a problem in practice than for the mirror because we're not at the active layer here, but attaching new parents to a node in the middle of the chain is possible, so the size needs to be correct anyway.
Signed-off-by Kevin Wolf <[email protected]>--- block/commit.c | 1 + 1 file changed, 1 insertion(+)
block/commit.c void commit_start(const char *job_id, BlockDriverState *bs, · line 338
Quoted 10 lines
block/commit.c +1
-0@@ -335,6 +335,7 @@ void commit_start(const char *job_id, BlockDriverState *bs,if (commit_top_bs ==NULL ) { goto fail; } + commit_top_bs->total_sectors = top->total_sectors;
[I'd really like to change total_sectors to bytes in 2.10 or later, but that's a much hairier mess to untangle. I've got some patches that I hope to post soon that at least start the process with regards to bdrv_is_allocated...]
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 6 lines · Kevin Wolf
The same problem that Fam's patch "mirror: Fix aio context of
mirror_top_bs" fixes for the mirror block job also exists for the commit block job and the 'commit' HMP command. While comparing the respective places inmirror.candcommit.c, I also noticed that commit neglects to set an image size.
Quoted 12 lines
This series fixes both problems.
Kevin Wolf (2):
commit: Setcommit_top_bs->aio_context
commit: Setcommit_top_bs->total_sectorsblock/commit.c | 3 +++ 1 file changed, 3 insertions(+)Signature · 1 line
1.8.3.1