Received: from eggs.gnu.org ([140.186.70.92]:42640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKi9O-0003ce-56 for qemu-devel@nongnu.org; Sun, 30 Oct 2011 23:03:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKi9M-0004ix-IW for qemu-devel@nongnu.org; Sun, 30 Oct 2011 23:03:01 -0400 Received: from e4.ny.us.ibm.com ([32.97.182.144]:45742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKi9M-0004in-Fb for qemu-devel@nongnu.org; Sun, 30 Oct 2011 23:03:00 -0400 Received: from /spool/local by e4.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 30 Oct 2011 23:02:55 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9V32rBx243840 for ; Sun, 30 Oct 2011 23:02:53 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9V32rDp020617 for ; Mon, 31 Oct 2011 01:02:53 -0200 From: Zhi Yong Wu Date: Mon, 31 Oct 2011 11:01:49 +0800 Message-Id: <1320030109-20476-1-git-send-email-wuzhy@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] qed: adjust the way to get nb_sectors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, Zhi Yong Wu , stefanha@linux.vnet.ibm.com It is better to use qiov.size in qed-table.c to get nb_sectors than iov.iov_len. Signed-off-by: Zhi Yong Wu --- 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