From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlGAM-0003hB-90 for qemu-devel@nongnu.org; Mon, 03 Nov 2014 06:51:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlGAH-0008VP-2n for qemu-devel@nongnu.org; Mon, 03 Nov 2014 06:51:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlGAG-0008VE-Ql for qemu-devel@nongnu.org; Mon, 03 Nov 2014 06:51:17 -0500 From: Stefan Hajnoczi Date: Mon, 3 Nov 2014 11:50:05 +0000 Message-Id: <1415015456-25086-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1415015456-25086-1-git-send-email-stefanha@redhat.com> References: <1415015456-25086-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 02/53] BlockLimits: introduce max_transfer_length List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Peter Lieven , Stefan Hajnoczi From: Peter Lieven Signed-off-by: Peter Lieven Reviewed-by: Max Reitz Signed-off-by: Stefan Hajnoczi --- block.c | 4 ++++ include/block/block_int.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/block.c b/block.c index 88f6d9b..76fcc1d 100644 --- a/block.c +++ b/block.c @@ -519,6 +519,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; @@ -533,6 +534,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 8898c6c..a293e92 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.9.3