diff options
author | Kevin Wolf <kwolf@redhat.com> | 2009-05-25 11:38:59 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-05-27 09:45:10 -0500 |
commit | ade406775d3795141927bdd581edee2cb44da864 (patch) | |
tree | e8ec65c3b13e4b5160232671dd7130ac2ccf33da /block/qcow.c | |
parent | cab3c825371b73fa71ada4dfa8d64ca99bc08638 (diff) | |
download | qemu-ade406775d3795141927bdd581edee2cb44da864.tar.gz qemu-ade406775d3795141927bdd581edee2cb44da864.tar.bz2 qemu-ade406775d3795141927bdd581edee2cb44da864.zip |
qcow/qcow2: Drop synchronous qcow_write()
There is only one (internal) user left and it can be switched to the normal
emulation provided in block.c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block/qcow.c')
-rw-r--r-- | block/qcow.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/block/qcow.c b/block/qcow.c index 6ecf2e8e03..77c86e47ce 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -488,41 +488,6 @@ static int qcow_read(BlockDriverState *bs, int64_t sector_num, } #endif -static int qcow_write(BlockDriverState *bs, int64_t sector_num, - const uint8_t *buf, int nb_sectors) -{ - BDRVQcowState *s = bs->opaque; - int ret, index_in_cluster, n; - uint64_t cluster_offset; - - while (nb_sectors > 0) { - index_in_cluster = sector_num & (s->cluster_sectors - 1); - n = s->cluster_sectors - index_in_cluster; - if (n > nb_sectors) - n = nb_sectors; - cluster_offset = get_cluster_offset(bs, sector_num << 9, 1, 0, - index_in_cluster, - index_in_cluster + n); - if (!cluster_offset) - return -1; - if (s->crypt_method) { - encrypt_sectors(s, sector_num, s->cluster_data, buf, n, 1, - &s->aes_encrypt_key); - ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, - s->cluster_data, n * 512); - } else { - ret = bdrv_pwrite(s->hd, cluster_offset + index_in_cluster * 512, buf, n * 512); - } - if (ret != n * 512) - return -1; - nb_sectors -= n; - sector_num += n; - buf += n * 512; - } - s->cluster_cache_offset = -1; /* disable compressed cache */ - return 0; -} - typedef struct QCowAIOCB { BlockDriverAIOCB common; int64_t sector_num; @@ -904,7 +869,7 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, if (ret != Z_STREAM_END || out_len >= s->cluster_size) { /* could not compress: write normal cluster */ - qcow_write(bs, sector_num, buf, s->cluster_sectors); + bdrv_write(bs, sector_num, buf, s->cluster_sectors); } else { cluster_offset = get_cluster_offset(bs, sector_num << 9, 2, out_len, 0, 0); |