diff options
author | Eric Blake <eblake@redhat.com> | 2016-07-15 17:22:57 -0600 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2016-07-20 14:11:55 +0100 |
commit | 4da444a0bb5b6a7563a785f027402e5af4bd53aa (patch) | |
tree | d583054df368ff5c61087f9860165115f3c3dd69 /block/raw-posix.c | |
parent | 7bbca9e290a9c7c217b5a24fc6094e91e54bd05d (diff) |
block: Convert .bdrv_aio_discard() to byte-based
Another step towards byte-based interfaces everywhere. Replace
the sector-based driver callback .bdrv_aio_discard() with a new
byte-based .bdrv_aio_pdiscard(). Only raw-posix and RBD drivers
are affected, so it was not worth splitting into multiple patches.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1468624988-423-9-git-send-email-eblake@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/raw-posix.c')
-rw-r--r-- | block/raw-posix.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c index b48efb3859..6ed7547392 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1786,14 +1786,13 @@ static int64_t coroutine_fn raw_co_get_block_status(BlockDriverState *bs, return ret | BDRV_BLOCK_OFFSET_VALID | start; } -static coroutine_fn BlockAIOCB *raw_aio_discard(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, +static coroutine_fn BlockAIOCB *raw_aio_pdiscard(BlockDriverState *bs, + int64_t offset, int count, BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; - return paio_submit(bs, s->fd, sector_num << BDRV_SECTOR_BITS, NULL, - nb_sectors << BDRV_SECTOR_BITS, + return paio_submit(bs, s->fd, offset, NULL, count, cb, opaque, QEMU_AIO_DISCARD); } @@ -1865,7 +1864,7 @@ BlockDriver bdrv_file = { .bdrv_co_preadv = raw_co_preadv, .bdrv_co_pwritev = raw_co_pwritev, .bdrv_aio_flush = raw_aio_flush, - .bdrv_aio_discard = raw_aio_discard, + .bdrv_aio_pdiscard = raw_aio_pdiscard, .bdrv_refresh_limits = raw_refresh_limits, .bdrv_io_plug = raw_aio_plug, .bdrv_io_unplug = raw_aio_unplug, @@ -2204,8 +2203,8 @@ static int fd_open(BlockDriverState *bs) return -EIO; } -static coroutine_fn BlockAIOCB *hdev_aio_discard(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, +static coroutine_fn BlockAIOCB *hdev_aio_pdiscard(BlockDriverState *bs, + int64_t offset, int count, BlockCompletionFunc *cb, void *opaque) { BDRVRawState *s = bs->opaque; @@ -2213,8 +2212,7 @@ static coroutine_fn BlockAIOCB *hdev_aio_discard(BlockDriverState *bs, if (fd_open(bs) < 0) { return NULL; } - return paio_submit(bs, s->fd, sector_num << BDRV_SECTOR_BITS, NULL, - nb_sectors << BDRV_SECTOR_BITS, + return paio_submit(bs, s->fd, offset, NULL, count, cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV); } @@ -2309,7 +2307,7 @@ static BlockDriver bdrv_host_device = { .bdrv_co_preadv = raw_co_preadv, .bdrv_co_pwritev = raw_co_pwritev, .bdrv_aio_flush = raw_aio_flush, - .bdrv_aio_discard = hdev_aio_discard, + .bdrv_aio_pdiscard = hdev_aio_pdiscard, .bdrv_refresh_limits = raw_refresh_limits, .bdrv_io_plug = raw_aio_plug, .bdrv_io_unplug = raw_aio_unplug, |