aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-07-15 17:23:03 -0600
committerStefan Hajnoczi <stefanha@redhat.com>2016-07-20 14:24:25 +0100
commit82e8a7888b7840e6b1770e131970d031ad64bc5b (patch)
tree069964dd33a60b0341496f517db4533eb44ac869 /block
parent447e57c3b056c310463238268d514798b23c376f (diff)
downloadqemu-82e8a7888b7840e6b1770e131970d031ad64bc5b.zip
qemu-82e8a7888b7840e6b1770e131970d031ad64bc5b.tar.gz
qemu-82e8a7888b7840e6b1770e131970d031ad64bc5b.tar.bz2
qcow2: Switch .bdrv_co_discard() to byte-based
Another step towards killing off sector-based block APIs. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1468624988-423-15-git-send-email-eblake@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/qcow2.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index a6bca73..d620d0a 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2479,15 +2479,15 @@ static coroutine_fn int qcow2_co_pwrite_zeroes(BlockDriverState *bs,
return ret;
}
-static coroutine_fn int qcow2_co_discard(BlockDriverState *bs,
- int64_t sector_num, int nb_sectors)
+static coroutine_fn int qcow2_co_pdiscard(BlockDriverState *bs,
+ int64_t offset, int count)
{
int ret;
BDRVQcow2State *s = bs->opaque;
qemu_co_mutex_lock(&s->lock);
- ret = qcow2_discard_clusters(bs, sector_num << BDRV_SECTOR_BITS,
- nb_sectors, QCOW2_DISCARD_REQUEST, false);
+ ret = qcow2_discard_clusters(bs, offset, count >> BDRV_SECTOR_BITS,
+ QCOW2_DISCARD_REQUEST, false);
qemu_co_mutex_unlock(&s->lock);
return ret;
}
@@ -3410,7 +3410,7 @@ BlockDriver bdrv_qcow2 = {
.bdrv_co_flush_to_os = qcow2_co_flush_to_os,
.bdrv_co_pwrite_zeroes = qcow2_co_pwrite_zeroes,
- .bdrv_co_discard = qcow2_co_discard,
+ .bdrv_co_pdiscard = qcow2_co_pdiscard,
.bdrv_truncate = qcow2_truncate,
.bdrv_write_compressed = qcow2_write_compressed,
.bdrv_make_empty = qcow2_make_empty,