qcow2: Move sync out of qcow2_alloc_clusters
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
1c4c28149f
commit
29216ed14f
@ -60,6 +60,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, int min_size)
|
|||||||
qemu_free(new_l1_table);
|
qemu_free(new_l1_table);
|
||||||
return new_l1_table_offset;
|
return new_l1_table_offset;
|
||||||
}
|
}
|
||||||
|
bdrv_flush(bs->file);
|
||||||
|
|
||||||
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_WRITE_TABLE);
|
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_WRITE_TABLE);
|
||||||
for(i = 0; i < s->l1_size; i++)
|
for(i = 0; i < s->l1_size; i++)
|
||||||
@ -243,6 +244,7 @@ static int l2_allocate(BlockDriverState *bs, int l1_index, uint64_t **table)
|
|||||||
if (l2_offset < 0) {
|
if (l2_offset < 0) {
|
||||||
return l2_offset;
|
return l2_offset;
|
||||||
}
|
}
|
||||||
|
bdrv_flush(bs->file);
|
||||||
|
|
||||||
/* allocate a new entry in the l2 cache */
|
/* allocate a new entry in the l2 cache */
|
||||||
|
|
||||||
@ -863,6 +865,7 @@ int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset,
|
|||||||
QLIST_REMOVE(m, next_in_flight);
|
QLIST_REMOVE(m, next_in_flight);
|
||||||
return cluster_offset;
|
return cluster_offset;
|
||||||
}
|
}
|
||||||
|
bdrv_flush(bs->file);
|
||||||
|
|
||||||
/* save info needed for meta data update */
|
/* save info needed for meta data update */
|
||||||
m->offset = offset;
|
m->offset = offset;
|
||||||
|
@ -629,8 +629,6 @@ int64_t qcow2_alloc_clusters(BlockDriverState *bs, int64_t size)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bdrv_flush(bs->file);
|
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,6 +676,8 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size)
|
|||||||
goto redo;
|
goto redo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bdrv_flush(bs->file);
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ static int qcow_write_snapshots(BlockDriverState *bs)
|
|||||||
snapshots_size = offset;
|
snapshots_size = offset;
|
||||||
|
|
||||||
snapshots_offset = qcow2_alloc_clusters(bs, snapshots_size);
|
snapshots_offset = qcow2_alloc_clusters(bs, snapshots_size);
|
||||||
|
bdrv_flush(bs->file);
|
||||||
offset = snapshots_offset;
|
offset = snapshots_offset;
|
||||||
if (offset < 0) {
|
if (offset < 0) {
|
||||||
return offset;
|
return offset;
|
||||||
@ -271,6 +272,7 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
|
|||||||
if (l1_table_offset < 0) {
|
if (l1_table_offset < 0) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
bdrv_flush(bs->file);
|
||||||
|
|
||||||
sn->l1_table_offset = l1_table_offset;
|
sn->l1_table_offset = l1_table_offset;
|
||||||
sn->l1_size = s->l1_size;
|
sn->l1_size = s->l1_size;
|
||||||
|
Loading…
Reference in New Issue
Block a user