diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-06-01 16:55:05 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-06-16 15:19:55 +0200 |
commit | d46a0bb24d6061c1eadcf1136fa73dc7c4ac267d (patch) | |
tree | c6bd837ba2b8b703a714c898838efa0c25340c4f /block/qcow2-cluster.c | |
parent | 8556739355d2a5392334c237486e32bd0f24c227 (diff) |
qcow2: Implement .bdrv_co_pwritev()
This changes qcow2 to implement the byte-based .bdrv_co_pwritev
interface rather than the sector-based old one.
As preallocation uses the same allocation function as normal writes, and
the interface of that function needs to be changed, it is converted in
the same patch.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/qcow2-cluster.c')
-rw-r--r-- | block/qcow2-cluster.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index b24230b12c..893ddf6798 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -1265,7 +1265,8 @@ fail: * Return 0 on success and -errno in error cases */ int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, - int *num, uint64_t *host_offset, QCowL2Meta **m) + unsigned int *bytes, uint64_t *host_offset, + QCowL2Meta **m) { BDRVQcow2State *s = bs->opaque; uint64_t start, remaining; @@ -1273,13 +1274,11 @@ int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, uint64_t cur_bytes; int ret; - trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), offset, *num); - - assert((offset & ~BDRV_SECTOR_MASK) == 0); + trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), offset, *bytes); again: start = offset; - remaining = (uint64_t)*num << BDRV_SECTOR_BITS; + remaining = *bytes; cluster_offset = 0; *host_offset = 0; cur_bytes = 0; @@ -1365,8 +1364,8 @@ again: } } - *num -= remaining >> BDRV_SECTOR_BITS; - assert(*num > 0); + *bytes -= remaining; + assert(*bytes > 0); assert(*host_offset != 0); return 0; |