[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 03/41] qed: adjust the way to get nb_sectors
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 03/41] qed: adjust the way to get nb_sectors |
Date: |
Mon, 5 Dec 2011 15:20:40 +0100 |
From: Zhi Yong Wu <address@hidden>
This patch is only to refactor some lines of codes to get better and more
robust codes.
As you have seen, in qed_read_table_cb() it's nice to
use qiov->size because that function doesn't obviously use a single
struct iovec.
In other two functions, if qiov use more than one struct iovec, the existing
way will get wrong nb_sectors.
To make the code more robust, it will be nicer to refactor the existing way as
below.
Signed-off-by: Zhi Yong Wu <address@hidden>
Acked-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qed-table.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/qed-table.c b/block/qed-table.c
index f31f9ff..8ee8443 100644
--- a/block/qed-table.c
+++ b/block/qed-table.c
@@ -29,7 +29,7 @@ static void qed_read_table_cb(void *opaque, int ret)
{
QEDReadTableCB *read_table_cb = opaque;
QEDTable *table = read_table_cb->table;
- int noffsets = read_table_cb->iov.iov_len / sizeof(uint64_t);
+ int noffsets = read_table_cb->qiov.size / sizeof(uint64_t);
int i;
/* Handle I/O error */
@@ -65,7 +65,7 @@ static void qed_read_table(BDRVQEDState *s, uint64_t offset,
QEDTable *table,
qemu_iovec_init_external(qiov, &read_table_cb->iov, 1);
aiocb = bdrv_aio_readv(s->bs->file, offset / BDRV_SECTOR_SIZE, qiov,
- read_table_cb->iov.iov_len / BDRV_SECTOR_SIZE,
+ qiov->size / BDRV_SECTOR_SIZE,
qed_read_table_cb, read_table_cb);
if (!aiocb) {
qed_read_table_cb(read_table_cb, -EIO);
@@ -160,7 +160,7 @@ static void qed_write_table(BDRVQEDState *s, uint64_t
offset, QEDTable *table,
aiocb = bdrv_aio_writev(s->bs->file, offset / BDRV_SECTOR_SIZE,
&write_table_cb->qiov,
- write_table_cb->iov.iov_len / BDRV_SECTOR_SIZE,
+ write_table_cb->qiov.size / BDRV_SECTOR_SIZE,
qed_write_table_cb, write_table_cb);
if (!aiocb) {
qed_write_table_cb(write_table_cb, -EIO);
--
1.7.6.4
- [Qemu-devel] [PULL 00/41] Block patches, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 01/41] qcow2: Unlock during COW, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 08/41] block: add I/O throttling algorithm, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 07/41] CoQueue: introduce qemu_co_queue_wait_insert_head, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 05/41] block: Use bdrv functions to replace file operation in cow.c, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 04/41] xen_disk: remove dead code, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 06/41] block: add the blockio limits command line support, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 02/41] qcow2: avoid reentrant bdrv_read() in copy_sectors(), Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 03/41] qed: adjust the way to get nb_sectors,
Kevin Wolf <=
- [Qemu-devel] [PATCH 13/41] qcow2: Update snapshot table information at once, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 15/41] qcow2: Rework qcow2_snapshot_create error handling, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 10/41] block: Add coroutine_fn marker to coroutine functions, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 09/41] hmp/qmp: add block_set_io_throttle, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 12/41] qcow2: Return real error code in qcow2_write_snapshots, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 11/41] qcow2: Return real error code in qcow2_read_snapshots, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 14/41] qcow2: Cleanups and memleak fix in qcow2_snapshot_create, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 16/41] qcow2: Return real error in qcow2_snapshot_goto, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 19/41] qcow2: Fix error path in qcow2_snapshot_load_tmp, Kevin Wolf, 2011/12/05
- [Qemu-devel] [PATCH 18/41] qcow2: Fix order in qcow2_snapshot_delete, Kevin Wolf, 2011/12/05