commit.c (ccd6a37947574707613e826e2bf04d55f1d5f238) commit.c (004915a96a7a40e942ac85e6d22518cbcd283506)
1/*
2 * Live block commit
3 *
4 * Copyright Red Hat, Inc. 2012
5 *
6 * Authors:
7 * Jeff Cody <jcody@redhat.com>
8 * Based on stream.c by Stefan Hajnoczi

--- 81 unchanged lines hidden (view full) ---

90
91 /* If bdrv_drop_intermediate() failed (or was not invoked), remove the
92 * commit filter driver from the backing chain now. Do this as the final
93 * step so that the 'consistent read' permission can be granted.
94 *
95 * XXX Can (or should) we somehow keep 'consistent read' blocked even
96 * after the failed/cancelled commit job is gone? If we already wrote
97 * something to base, the intermediate images aren't valid any more. */
1/*
2 * Live block commit
3 *
4 * Copyright Red Hat, Inc. 2012
5 *
6 * Authors:
7 * Jeff Cody <jcody@redhat.com>
8 * Based on stream.c by Stefan Hajnoczi

--- 81 unchanged lines hidden (view full) ---

90
91 /* If bdrv_drop_intermediate() failed (or was not invoked), remove the
92 * commit filter driver from the backing chain now. Do this as the final
93 * step so that the 'consistent read' permission can be granted.
94 *
95 * XXX Can (or should) we somehow keep 'consistent read' blocked even
96 * after the failed/cancelled commit job is gone? If we already wrote
97 * something to base, the intermediate images aren't valid any more. */
98 bdrv_graph_rdlock_main_loop();
98 commit_top_backing_bs = s->commit_top_bs->backing->bs;
99 commit_top_backing_bs = s->commit_top_bs->backing->bs;
100 bdrv_graph_rdunlock_main_loop();
101
99 bdrv_drained_begin(commit_top_backing_bs);
100 bdrv_graph_wrlock(commit_top_backing_bs);
101 bdrv_replace_node(s->commit_top_bs, commit_top_backing_bs, &error_abort);
102 bdrv_graph_wrunlock();
103 bdrv_drained_end(commit_top_backing_bs);
104
105 bdrv_unref(s->commit_top_bs);
106 bdrv_unref(top_bs);

--- 107 unchanged lines hidden (view full) ---

214
215static int coroutine_fn GRAPH_RDLOCK
216bdrv_commit_top_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes,
217 QEMUIOVector *qiov, BdrvRequestFlags flags)
218{
219 return bdrv_co_preadv(bs->backing, offset, bytes, qiov, flags);
220}
221
102 bdrv_drained_begin(commit_top_backing_bs);
103 bdrv_graph_wrlock(commit_top_backing_bs);
104 bdrv_replace_node(s->commit_top_bs, commit_top_backing_bs, &error_abort);
105 bdrv_graph_wrunlock();
106 bdrv_drained_end(commit_top_backing_bs);
107
108 bdrv_unref(s->commit_top_bs);
109 bdrv_unref(top_bs);

--- 107 unchanged lines hidden (view full) ---

217
218static int coroutine_fn GRAPH_RDLOCK
219bdrv_commit_top_preadv(BlockDriverState *bs, int64_t offset, int64_t bytes,
220 QEMUIOVector *qiov, BdrvRequestFlags flags)
221{
222 return bdrv_co_preadv(bs->backing, offset, bytes, qiov, flags);
223}
224
222static void bdrv_commit_top_refresh_filename(BlockDriverState *bs)
225static GRAPH_RDLOCK void bdrv_commit_top_refresh_filename(BlockDriverState *bs)
223{
224 pstrcpy(bs->exact_filename, sizeof(bs->exact_filename),
225 bs->backing->bs->filename);
226}
227
228static void bdrv_commit_top_child_perm(BlockDriverState *bs, BdrvChild *c,
229 BdrvChildRole role,
230 BlockReopenQueue *reopen_queue,

--- 363 unchanged lines hidden ---
226{
227 pstrcpy(bs->exact_filename, sizeof(bs->exact_filename),
228 bs->backing->bs->filename);
229}
230
231static void bdrv_commit_top_child_perm(BlockDriverState *bs, BdrvChild *c,
232 BdrvChildRole role,
233 BlockReopenQueue *reopen_queue,

--- 363 unchanged lines hidden ---