From patchwork Wed Mar 27 17:32:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 1067249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=citrix.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44Tw8B168Vz9sSp for ; Thu, 28 Mar 2019 04:33:29 +1100 (AEDT) Received: from localhost ([127.0.0.1]:51320 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9CQZ-0001wp-T1 for incoming@patchwork.ozlabs.org; Wed, 27 Mar 2019 13:33:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9CPU-0001sV-QA for qemu-devel@nongnu.org; Wed, 27 Mar 2019 13:32:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9CPT-0000Fe-MS for qemu-devel@nongnu.org; Wed, 27 Mar 2019 13:32:20 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:52218) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h9CPP-00007j-KX; Wed, 27 Mar 2019 13:32:15 -0400 X-IronPort-AV: E=Sophos;i="5.60,277,1549929600"; d="scan'208";a="81999313" From: Paul Durrant To: , , Date: Wed, 27 Mar 2019 17:32:06 +0000 Message-ID: <20190327173206.9065-3-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb6 In-Reply-To: <20190327173206.9065-1-paul.durrant@citrix.com> References: <20190327173206.9065-1-paul.durrant@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 162.221.156.55 Subject: [Qemu-devel] [PATCH v2 2/2] xen-block: always report 'sectors' in terms of 512-byte units X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anthony Perard , Kevin Wolf , Paul Durrant , Stefano Stabellini , Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The mail thread at [1] clarifies that the Xen blkif protocol requires that 'sectors' value reported in xenstore is strictly in terms of 512-byte units and is not dependent on the logical sector size reported in 'sector-size'. [1] https://lists.xenproject.org/archives/html/xen-devel/2019-03/msg01600.html Signed-off-by: Paul Durrant --- Cc: Stefano Stabellini Cc: Anthony Perard Cc: Kevin Wolf Cc: Max Reitz --- hw/block/xen-block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index a848849f48..57e9da7e1c 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -149,7 +149,7 @@ static void xen_block_set_size(XenBlockDevice *blockdev) const char *type = object_get_typename(OBJECT(blockdev)); XenBlockVdev *vdev = &blockdev->props.vdev; BlockConf *conf = &blockdev->props.conf; - int64_t sectors = blk_getlength(conf->blk) / conf->logical_block_size; + int64_t sectors = blk_getlength(conf->blk) / XEN_BLKIF_SECTOR_SIZE; XenDevice *xendev = XEN_DEVICE(blockdev); trace_xen_block_size(type, vdev->disk, vdev->partition, sectors);