From patchwork Mon Apr 30 15:52:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 155911 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0788DB6F13 for ; Tue, 1 May 2012 01:53:09 +1000 (EST) Received: from localhost ([::1]:49201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOsuQ-0000Xl-Em for incoming@patchwork.ozlabs.org; Mon, 30 Apr 2012 11:53:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOsuJ-0000XZ-UQ for qemu-devel@nongnu.org; Mon, 30 Apr 2012 11:53:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SOsuE-0004uy-6u for qemu-devel@nongnu.org; Mon, 30 Apr 2012 11:52:59 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:58704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOsuD-0004tE-Vu for qemu-devel@nongnu.org; Mon, 30 Apr 2012 11:52:54 -0400 Received: from gandalf.tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id 0B158A18A8; Mon, 30 Apr 2012 19:52:43 +0400 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id 8E0FDA8CB; Mon, 30 Apr 2012 19:52:42 +0400 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org, Anthony Liguori , Kevin Wolf Date: Mon, 30 Apr 2012 19:52:40 +0400 Message-Id: <1335801160-321-1-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 86.62.121.231 Cc: Michael Tokarev Subject: [Qemu-devel] [PATCH] increase BlockConf.min_io_size type from uint16_t to uint32_t X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This value is used currently for virtio-blk only. It was defined as uint16_t before, which is the same as in kernel<=>user interface (in virtio_blk.h, struct virtio_blk_config). But the problem is that in kernel<=>user interface the units are sectors (which is usually 512 bytes or more), while in qemu it is in bytes. However, for, say, md raid5 arrays, it is typical to have actual min_io_size of a host device to be large. For example, for raid5 device of 3 drives with 64Kb chunk size, that value will be 128Kb, which does not fit in a uint16_t anymore. Increase the value size from 16bits to 32bits for now. But apparently, the kernel<=>user interface needs to be fixed too (while it is much more difficult due to compatibility issues), because even with 512byte units, the 16bit value there will overflow too with quite normal MD RAID configuration. Signed-off-by: Michael Tokarev Reviewed-by: Stefan Hajnoczi --- block.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block.h b/block.h index f163e54..cd5ae79 100644 --- a/block.h +++ b/block.h @@ -425,7 +425,7 @@ typedef struct BlockConf { BlockDriverState *bs; uint16_t physical_block_size; uint16_t logical_block_size; - uint16_t min_io_size; + uint32_t min_io_size; uint32_t opt_io_size; int32_t bootindex; uint32_t discard_granularity; @@ -450,7 +450,7 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf) _conf.logical_block_size, 512), \ DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \ _conf.physical_block_size, 512), \ - DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \ + DEFINE_PROP_UINT32("min_io_size", _state, _conf.min_io_size, 0), \ DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \ DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1), \ DEFINE_PROP_UINT32("discard_granularity", _state, \