aboutsummaryrefslogtreecommitdiff
path: root/block/io.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-07-15 17:22:53 -0600
committerStefan Hajnoczi <stefanha@redhat.com>2016-07-20 14:11:55 +0100
commit60ebac16bca3e3bf07c7ae67a69a7730aaa48712 (patch)
tree491c563bc5d94b764865533ab3b9e4db1e25035f /block/io.c
parentb15404e0273e20baddcbbc1e8915f2e9ee9b117b (diff)
downloadqemu-60ebac16bca3e3bf07c7ae67a69a7730aaa48712.zip
qemu-60ebac16bca3e3bf07c7ae67a69a7730aaa48712.tar.gz
qemu-60ebac16bca3e3bf07c7ae67a69a7730aaa48712.tar.bz2
block: Convert bdrv_aio_discard() to byte-based
Another step towards byte-based interfaces everywhere. Replace the sector-based bdrv_aio_discard() with a new byte-based bdrv_aio_pdiscard(), which silently ignores any unaligned head or tail. Driver callbacks will be converted in followup patches. Signed-off-by: Eric Blake <eblake@redhat.com> Message-id: 1468624988-423-5-git-send-email-eblake@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r--block/io.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/block/io.c b/block/io.c
index 85953bb..58fdac5 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2193,7 +2193,7 @@ BlockAIOCB *bdrv_aio_flush(BlockDriverState *bs,
return &acb->common;
}
-static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque)
+static void coroutine_fn bdrv_aio_pdiscard_co_entry(void *opaque)
{
BlockAIOCBCoroutine *acb = opaque;
BlockDriverState *bs = acb->common.bs;
@@ -2202,21 +2202,20 @@ static void coroutine_fn bdrv_aio_discard_co_entry(void *opaque)
bdrv_co_complete(acb);
}
-BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs,
- int64_t sector_num, int nb_sectors,
- BlockCompletionFunc *cb, void *opaque)
+BlockAIOCB *bdrv_aio_pdiscard(BlockDriverState *bs, int64_t offset, int count,
+ BlockCompletionFunc *cb, void *opaque)
{
Coroutine *co;
BlockAIOCBCoroutine *acb;
- trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque);
+ trace_bdrv_aio_pdiscard(bs, offset, count, opaque);
acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);
acb->need_bh = true;
acb->req.error = -EINPROGRESS;
- acb->req.offset = sector_num << BDRV_SECTOR_BITS;
- acb->req.bytes = nb_sectors << BDRV_SECTOR_BITS;
- co = qemu_coroutine_create(bdrv_aio_discard_co_entry, acb);
+ acb->req.offset = offset;
+ acb->req.bytes = count;
+ co = qemu_coroutine_create(bdrv_aio_pdiscard_co_entry, acb);
qemu_coroutine_enter(co);
bdrv_co_maybe_schedule_bh(acb);