[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/19] block: do not allocate an iovec per read of a
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 05/19] block: do not allocate an iovec per read of a growable/zero_after_eof BDS |
Date: |
Fri, 19 Dec 2014 17:34:55 +0100 |
From: Paolo Bonzini <address@hidden>
Most reads do not go past the end of the file, and they can use the
input QEMUIOVector instead of creating one. This removes the
qemu_iovec_* functions from the profile.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/block.c b/block.c
index 4165d42..58f8042 100644
--- a/block.c
+++ b/block.c
@@ -3034,18 +3034,16 @@ static int coroutine_fn
bdrv_aligned_preadv(BlockDriverState *bs,
max_nb_sectors = ROUND_UP(MAX(0, total_sectors - sector_num),
align >> BDRV_SECTOR_BITS);
- if (max_nb_sectors > 0) {
+ if (nb_sectors < max_nb_sectors) {
+ ret = drv->bdrv_co_readv(bs, sector_num, nb_sectors, qiov);
+ } else if (max_nb_sectors > 0) {
QEMUIOVector local_qiov;
- size_t local_sectors;
-
- max_nb_sectors = MIN(max_nb_sectors, SIZE_MAX / BDRV_SECTOR_BITS);
- local_sectors = MIN(max_nb_sectors, nb_sectors);
qemu_iovec_init(&local_qiov, qiov->niov);
qemu_iovec_concat(&local_qiov, qiov, 0,
- local_sectors * BDRV_SECTOR_SIZE);
+ max_nb_sectors * BDRV_SECTOR_SIZE);
- ret = drv->bdrv_co_readv(bs, sector_num, local_sectors,
+ ret = drv->bdrv_co_readv(bs, sector_num, max_nb_sectors,
&local_qiov);
qemu_iovec_destroy(&local_qiov);
--
1.8.3.1
- [Qemu-devel] [PULL 14/19] block: drop unused bdrv_clear_incoming_migration_all() prototype, (continued)
- [Qemu-devel] [PULL 14/19] block: drop unused bdrv_clear_incoming_migration_all() prototype, Stefan Hajnoczi, 2014/12/12
- [Qemu-devel] [PULL 15/19] linux-aio: queue requests that cannot be submitted, Stefan Hajnoczi, 2014/12/12
- [Qemu-devel] [PULL 16/19] linux-aio: track whether the queue is blocked, Stefan Hajnoczi, 2014/12/12
- [Qemu-devel] [PULL 17/19] linux-aio: rename LaioQueue idx field to "n", Stefan Hajnoczi, 2014/12/12
- [Qemu-devel] [PULL 18/19] linux-aio: drop return code from laio_io_unplug and ioq_submit, Stefan Hajnoczi, 2014/12/12
- [Qemu-devel] [PULL 19/19] linux-aio: simplify removal of completed iocbs from the list, Stefan Hajnoczi, 2014/12/12
- [Qemu-devel] [PULL 12/19] qemu-iotests: Remove traling whitespaces in *.out, Stefan Hajnoczi, 2014/12/12
- Re: [Qemu-devel] [PULL 00/19] Block patches, Peter Maydell, 2014/12/15
- [Qemu-devel] [PULL 00/19] Block patches, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 02/19] qemu-iotests: Speed up make check-block, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 05/19] block: do not allocate an iovec per read of a growable/zero_after_eof BDS,
Kevin Wolf <=
- [Qemu-devel] [PULL 06/19] block: replace g_new0 with g_new for bottom half allocation., Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 01/19] qemu-iotests: Remove 091 from quick group, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 07/19] checkpatch: Brace handling on multi-line condition, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 04/19] block: mark AioContext as recursive, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 12/19] iotests: Add test for relative backing file names, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 03/19] tests/Makefile: Add check-block to make check, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 11/19] block/vmdk: Relative backing file for creation, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 08/19] block: Get full backing filename from string, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 14/19] block: fix spoiling all dirty bitmaps by mirror and migration, Kevin Wolf, 2014/12/19
- [Qemu-devel] [PULL 10/19] block: Relative backing file for image creation, Kevin Wolf, 2014/12/19