[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/31] raw-posix: Convert to bdrv_co_pwrite_zeroes()
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 15/31] raw-posix: Convert to bdrv_co_pwrite_zeroes() |
Date: |
Wed, 8 Jun 2016 11:16:41 +0200 |
From: Eric Blake <address@hidden>
Another step on our continuing quest to switch to byte-based
interfaces.
Signed-off-by: Eric Blake <address@hidden>
[ kwolf: Fixed up trace_paio_submit_co() call for qiov == NULL ]
Signed-off-by: Kevin Wolf <address@hidden>
---
block/raw-posix.c | 34 +++++++++++++++++-----------------
trace-events | 2 +-
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index a4f5a1b..ce1cf14 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1252,8 +1252,8 @@ static int aio_worker(void *arg)
}
static int paio_submit_co(BlockDriverState *bs, int fd,
- int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
- int type)
+ int64_t offset, QEMUIOVector *qiov,
+ int count, int type)
{
RawPosixAIOData *acb = g_new(RawPosixAIOData, 1);
ThreadPool *pool;
@@ -1262,16 +1262,16 @@ static int paio_submit_co(BlockDriverState *bs, int fd,
acb->aio_type = type;
acb->aio_fildes = fd;
- acb->aio_nbytes = nb_sectors * BDRV_SECTOR_SIZE;
- acb->aio_offset = sector_num * BDRV_SECTOR_SIZE;
+ acb->aio_nbytes = count;
+ acb->aio_offset = offset;
if (qiov) {
acb->aio_iov = qiov->iov;
acb->aio_niov = qiov->niov;
- assert(qiov->size == acb->aio_nbytes);
+ assert(qiov->size == count);
}
- trace_paio_submit_co(sector_num, nb_sectors, type);
+ trace_paio_submit_co(offset, count, type);
pool = aio_get_thread_pool(bdrv_get_aio_context(bs));
return thread_pool_submit_co(pool, aio_worker, acb);
}
@@ -1868,17 +1868,17 @@ static coroutine_fn BlockAIOCB
*raw_aio_discard(BlockDriverState *bs,
cb, opaque, QEMU_AIO_DISCARD);
}
-static int coroutine_fn raw_co_write_zeroes(
- BlockDriverState *bs, int64_t sector_num,
- int nb_sectors, BdrvRequestFlags flags)
+static int coroutine_fn raw_co_pwrite_zeroes(
+ BlockDriverState *bs, int64_t offset,
+ int count, BdrvRequestFlags flags)
{
BDRVRawState *s = bs->opaque;
if (!(flags & BDRV_REQ_MAY_UNMAP)) {
- return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,
+ return paio_submit_co(bs, s->fd, offset, NULL, count,
QEMU_AIO_WRITE_ZEROES);
} else if (s->discard_zeroes) {
- return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,
+ return paio_submit_co(bs, s->fd, offset, NULL, count,
QEMU_AIO_DISCARD);
}
return -ENOTSUP;
@@ -1931,7 +1931,7 @@ BlockDriver bdrv_file = {
.bdrv_create = raw_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_co_get_block_status = raw_co_get_block_status,
- .bdrv_co_write_zeroes = raw_co_write_zeroes,
+ .bdrv_co_pwrite_zeroes = raw_co_pwrite_zeroes,
.bdrv_aio_readv = raw_aio_readv,
.bdrv_aio_writev = raw_aio_writev,
@@ -2293,8 +2293,8 @@ static coroutine_fn BlockAIOCB
*hdev_aio_discard(BlockDriverState *bs,
cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
}
-static coroutine_fn int hdev_co_write_zeroes(BlockDriverState *bs,
- int64_t sector_num, int nb_sectors, BdrvRequestFlags flags)
+static coroutine_fn int hdev_co_pwrite_zeroes(BlockDriverState *bs,
+ int64_t offset, int count, BdrvRequestFlags flags)
{
BDRVRawState *s = bs->opaque;
int rc;
@@ -2304,10 +2304,10 @@ static coroutine_fn int
hdev_co_write_zeroes(BlockDriverState *bs,
return rc;
}
if (!(flags & BDRV_REQ_MAY_UNMAP)) {
- return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,
+ return paio_submit_co(bs, s->fd, offset, NULL, count,
QEMU_AIO_WRITE_ZEROES|QEMU_AIO_BLKDEV);
} else if (s->discard_zeroes) {
- return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors,
+ return paio_submit_co(bs, s->fd, offset, NULL, count,
QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
}
return -ENOTSUP;
@@ -2379,7 +2379,7 @@ static BlockDriver bdrv_host_device = {
.bdrv_reopen_abort = raw_reopen_abort,
.bdrv_create = hdev_create,
.create_opts = &raw_create_opts,
- .bdrv_co_write_zeroes = hdev_co_write_zeroes,
+ .bdrv_co_pwrite_zeroes = hdev_co_pwrite_zeroes,
.bdrv_aio_readv = raw_aio_readv,
.bdrv_aio_writev = raw_aio_writev,
diff --git a/trace-events b/trace-events
index b1ca05b..421d89f 100644
--- a/trace-events
+++ b/trace-events
@@ -131,7 +131,7 @@ thread_pool_cancel(void *req, void *opaque) "req %p opaque
%p"
# block/raw-win32.c
# block/raw-posix.c
-paio_submit_co(int64_t sector_num, int nb_sectors, int type) "sector_num
%"PRId64" nb_sectors %d type %d"
+paio_submit_co(int64_t offset, int count, int type) "offset %"PRId64" count %d
type %d"
paio_submit(void *acb, void *opaque, int64_t sector_num, int nb_sectors, int
type) "acb %p opaque %p sector_num %"PRId64" nb_sectors %d type %d"
# ioport.c
--
1.8.3.1
- [Qemu-devel] [PULL 08/31] block: Add .bdrv_co_pwrite_zeroes(), (continued)
- [Qemu-devel] [PULL 08/31] block: Add .bdrv_co_pwrite_zeroes(), Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 01/31] block: split write_zeroes always, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 03/31] qcow2: add tracepoints for qcow2_co_write_zeroes, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 10/31] iscsi: Convert to bdrv_co_pwrite_zeroes(), Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 11/31] qcow2: Convert to bdrv_co_pwrite_zeroes(), Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 05/31] qcow2: Catch more unaligned write_zero into zero cluster, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 17/31] vmdk: Convert to bdrv_co_pwrite_zeroes(), Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 19/31] migration/block: Convert load to BlockBackend, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 09/31] block: Switch bdrv_write_zeroes() to byte interface, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 21/31] block: assert that bs->request_alignment is a power of 2, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 15/31] raw-posix: Convert to bdrv_co_pwrite_zeroes(),
Kevin Wolf <=
- [Qemu-devel] [PULL 18/31] block: Kill bdrv_co_write_zeroes(), Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 04/31] qemu-iotests: Test one more spot for optimizing write_zeroes, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 13/31] gluster: Convert to bdrv_co_pwrite_zeroes(), Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 12/31] blkreplay: Convert to bdrv_co_pwrite_zeroes(), Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 16/31] raw_bsd: Convert to bdrv_co_pwrite_zeroes(), Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 14/31] qed: Convert to bdrv_co_pwrite_zeroes(), Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 28/31] qemu-img bench: Sequential writes, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 23/31] qcow2: avoid extra flushes in qcow2, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 27/31] qemu-img bench, Kevin Wolf, 2016/06/08
- [Qemu-devel] [PULL 24/31] block: Fix bdrv_all_delete_snapshot() error handling, Kevin Wolf, 2016/06/08