Received: from eggs.gnu.org ([2001:4830:134:3::10]:55648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xeful-0001pv-NC for qemu-devel@nongnu.org; Thu, 16 Oct 2014 03:56:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xefug-0000tC-0s for qemu-devel@nongnu.org; Thu, 16 Oct 2014 03:56:03 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:48132 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xefuf-0000sv-Mo for qemu-devel@nongnu.org; Thu, 16 Oct 2014 03:55:57 -0400 From: Peter Lieven Date: Thu, 16 Oct 2014 09:54:48 +0200 Message-Id: <1413446090-30050-3-git-send-email-pl@kamp.de> In-Reply-To: <1413446090-30050-1-git-send-email-pl@kamp.de> References: <1413446090-30050-1-git-send-email-pl@kamp.de> Subject: [Qemu-devel] [PATCHv4 2/4] BlockLimits: introduce max_transfer_length List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, Peter Lieven , mreitz@redhat.com, ronniesahlberg@gmail.com, pbonzini@redhat.com Signed-off-by: Peter Lieven --- block.c | 4 ++++ include/block/block_int.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/block.c b/block.c index 27533f3..0fbf916 100644 --- a/block.c +++ b/block.c @@ -536,6 +536,7 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error **errp) return; } bs->bl.opt_transfer_length = bs->file->bl.opt_transfer_length; + bs->bl.max_transfer_length = bs->file->bl.max_transfer_length; bs->bl.opt_mem_alignment = bs->file->bl.opt_mem_alignment; } else { bs->bl.opt_mem_alignment = 512; @@ -550,6 +551,9 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error **errp) bs->bl.opt_transfer_length = MAX(bs->bl.opt_transfer_length, bs->backing_hd->bl.opt_transfer_length); + bs->bl.max_transfer_length = + MIN_NON_ZERO(bs->bl.max_transfer_length, + bs->backing_hd->bl.max_transfer_length); bs->bl.opt_mem_alignment = MAX(bs->bl.opt_mem_alignment, bs->backing_hd->bl.opt_mem_alignment); diff --git a/include/block/block_int.h b/include/block/block_int.h index 8d86a6c..b13a10a 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -289,6 +289,9 @@ typedef struct BlockLimits { /* optimal transfer length in sectors */ int opt_transfer_length; + /* maximal transfer length in sectors */ + int max_transfer_length; + /* memory alignment so that no bounce buffer is needed */ size_t opt_mem_alignment; } BlockLimits; -- 1.7.9.5