From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35901) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLtDr-0001wu-Eo for qemu-devel@nongnu.org; Fri, 16 Jun 2017 11:31:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLtDq-00089Y-Lo for qemu-devel@nongnu.org; Fri, 16 Jun 2017 11:31:43 -0400 Date: Fri, 16 Jun 2017 17:31:27 +0200 From: Kevin Wolf Message-ID: <20170616153127.GA4366@noname.fritz.box> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v2 6/7] qcow2: Pass a QEMUIOVector to do_perform_cow_{read, write}() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Max Reitz , Eric Blake , "Denis V . Lunev" , Stefan Hajnoczi Am 07.06.2017 um 16:08 hat Alberto Garcia geschrieben: > Instead of passing a single buffer pointer to do_perform_cow_write(), > pass a QEMUIOVector. This will allow us to merge the write requests > for the COW regions and the actual data into a single one. > > Although do_perform_cow_read() does not strictly need to change its > API, we're doing it here as well for consistency. > > Signed-off-by: Alberto Garcia > --- > block/qcow2-cluster.c | 51 ++++++++++++++++++++++++--------------------------- > 1 file changed, 24 insertions(+), 27 deletions(-) > @@ -807,22 +798,25 @@ static int perform_cow(BlockDriverState *bs, QCowL2Meta *m) > /* The part of the buffer where the end region is located */ > end_buffer = start_buffer + buffer_size - end->nb_bytes; > > + qemu_iovec_init(&qiov, 3); > + You don't actually make use of more than one iovec in this patch. And after the last patch, the value is potentially too low - which isn't fatal because this is not a fixed maximum, but just a hint, but it can cause unnecessary memory allocations. It would probably be better to use 1 here and change it into 2 + m->data_qiov->niov when you add write merging. Kevin