summaryrefslogtreecommitdiffstats
path: root/block/raw-posix.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-10-20 13:16:25 +0200
committerKevin Wolf <kwolf@redhat.com>2011-10-21 17:34:14 +0200
commit6db39ae2e250f15da17462444ea18a9fcef41e05 (patch)
tree5589abb302dd9261348c7e67ca9a5eb2f89a14d5 /block/raw-posix.c
parent8b94ff85737062876c03e7506abb500521c749b9 (diff)
downloadhqemu-6db39ae2e250f15da17462444ea18a9fcef41e05.zip
hqemu-6db39ae2e250f15da17462444ea18a9fcef41e05.tar.gz
block: change discard to co_discard
Since coroutine operation is now mandatory, convert both bdrv_discard implementations to coroutines. For qcow2, this means taking the lock around the operation. raw-posix remains synchronous. The bdrv_discard callback is then unused and can be eliminated. Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/raw-posix.c')
-rw-r--r--block/raw-posix.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c
index afcb4c1..a3de373 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -602,7 +602,8 @@ static int xfs_discard(BDRVRawState *s, int64_t sector_num, int nb_sectors)
}
#endif
-static int raw_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors)
+static coroutine_fn int raw_co_discard(BlockDriverState *bs,
+ int64_t sector_num, int nb_sectors)
{
#ifdef CONFIG_XFS
BDRVRawState *s = bs->opaque;
@@ -632,7 +633,7 @@ static BlockDriver bdrv_file = {
.bdrv_file_open = raw_open,
.bdrv_close = raw_close,
.bdrv_create = raw_create,
- .bdrv_discard = raw_discard,
+ .bdrv_co_discard = raw_co_discard,
.bdrv_aio_readv = raw_aio_readv,
.bdrv_aio_writev = raw_aio_writev,
OpenPOWER on IntegriCloud