mirror.c (12fa4af61fb2a08b156134c3b6717534c637c995) mirror.c (b2c2832c6140cfe3ddc0de2d77eeb0b77dea8fd3)
1/*
2 * Image mirroring
3 *
4 * Copyright Red Hat, Inc. 2012
5 *
6 * Authors:
7 * Paolo Bonzini <pbonzini@redhat.com>
8 *

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

1094 const BlockJobDriver *driver,
1095 bool is_none_mode, BlockDriverState *base,
1096 bool auto_complete, const char *filter_node_name)
1097{
1098 MirrorBlockJob *s;
1099 BlockDriverState *mirror_top_bs;
1100 bool target_graph_mod;
1101 bool target_is_backing;
1/*
2 * Image mirroring
3 *
4 * Copyright Red Hat, Inc. 2012
5 *
6 * Authors:
7 * Paolo Bonzini <pbonzini@redhat.com>
8 *

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

1094 const BlockJobDriver *driver,
1095 bool is_none_mode, BlockDriverState *base,
1096 bool auto_complete, const char *filter_node_name)
1097{
1098 MirrorBlockJob *s;
1099 BlockDriverState *mirror_top_bs;
1100 bool target_graph_mod;
1101 bool target_is_backing;
1102 Error *local_err = NULL;
1102 int ret;
1103
1104 if (granularity == 0) {
1105 granularity = bdrv_get_default_bitmap_granularity(target);
1106 }
1107
1108 assert ((granularity & (granularity - 1)) == 0);
1109

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

1125 return;
1126 }
1127 mirror_top_bs->total_sectors = bs->total_sectors;
1128
1129 /* bdrv_append takes ownership of the mirror_top_bs reference, need to keep
1130 * it alive until block_job_create() even if bs has no parent. */
1131 bdrv_ref(mirror_top_bs);
1132 bdrv_drained_begin(bs);
1103 int ret;
1104
1105 if (granularity == 0) {
1106 granularity = bdrv_get_default_bitmap_granularity(target);
1107 }
1108
1109 assert ((granularity & (granularity - 1)) == 0);
1110

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

1126 return;
1127 }
1128 mirror_top_bs->total_sectors = bs->total_sectors;
1129
1130 /* bdrv_append takes ownership of the mirror_top_bs reference, need to keep
1131 * it alive until block_job_create() even if bs has no parent. */
1132 bdrv_ref(mirror_top_bs);
1133 bdrv_drained_begin(bs);
1133 bdrv_append(mirror_top_bs, bs);
1134 bdrv_append(mirror_top_bs, bs, &local_err);
1134 bdrv_drained_end(bs);
1135
1135 bdrv_drained_end(bs);
1136
1137 if (local_err) {
1138 bdrv_unref(mirror_top_bs);
1139 error_propagate(errp, local_err);
1140 return;
1141 }
1142
1136 /* Make sure that the source is not resized while the job is running */
1137 s = block_job_create(job_id, driver, mirror_top_bs,
1138 BLK_PERM_CONSISTENT_READ,
1139 BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED |
1140 BLK_PERM_WRITE | BLK_PERM_GRAPH_MOD, speed,
1141 creation_flags, cb, opaque, errp);
1142 bdrv_unref(mirror_top_bs);
1143 if (!s) {

--- 141 unchanged lines hidden ---
1143 /* Make sure that the source is not resized while the job is running */
1144 s = block_job_create(job_id, driver, mirror_top_bs,
1145 BLK_PERM_CONSISTENT_READ,
1146 BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED |
1147 BLK_PERM_WRITE | BLK_PERM_GRAPH_MOD, speed,
1148 creation_flags, cb, opaque, errp);
1149 bdrv_unref(mirror_top_bs);
1150 if (!s) {

--- 141 unchanged lines hidden ---