[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 04/44] block: do not allocate an iovec per read of
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL v2 04/44] block: do not allocate an iovec per read of a growable/zero_after_eof BDS |
Date: |
Mon, 12 Jan 2015 16:39:54 +0000 |
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);
--
2.1.0
- [Qemu-devel] [PULL v2 42/44] MAINTAINERS: Update email addresses for Chrysostomos Nanakos, (continued)
- [Qemu-devel] [PULL v2 42/44] MAINTAINERS: Update email addresses for Chrysostomos Nanakos, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 44/44] NVMe: Set correct VS Value for 1.1 Compliant Controllers, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 43/44] MAINTAINERS: Add migration/block* to block subsystem, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 27/44] .gitignore: Ignore generated "common.env", Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 01/44] qemu-iotests: Remove 091 from quick group, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 28/44] qemu-iotests: Replace "/bin/true" with "true", Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 15/44] qmp: Add command 'blockdev-backup', Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 03/44] block: mark AioContext as recursive, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 02/44] qemu-iotests: Speed up make check-block, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 30/44] qemu-iotests: Add supported os parameter for python tests, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 04/44] block: do not allocate an iovec per read of a growable/zero_after_eof BDS,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL v2 16/44] block: Add blockdev-backup to transaction, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 17/44] qemu-iotests: Test blockdev-backup in 055, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 14/44] qapi: Comment version info in TransactionAction, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 12/44] qapi: Fix document for BlockStats.node-name, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 19/44] migration/block: fix pending() return value, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 05/44] block: replace g_new0 with g_new for bottom half allocation., Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 11/44] iotests: Add test for relative backing file names, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 06/44] checkpatch: Brace handling on multi-line condition, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 18/44] iotests: Filter out "I/O thread spun..." warning, Stefan Hajnoczi, 2015/01/12
- [Qemu-devel] [PULL v2 29/44] qemu-iotests: Add "_supported_os Linux" to 058, Stefan Hajnoczi, 2015/01/12