From patchwork Tue Jun 21 22:26:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 9191497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 38C486075A for ; Tue, 21 Jun 2016 22:27:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 282D4281DB for ; Tue, 21 Jun 2016 22:27:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CE2B28324; Tue, 21 Jun 2016 22:27:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 637C0281DB for ; Tue, 21 Jun 2016 22:27:52 +0000 (UTC) Received: from localhost ([::1]:54646 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFU99-00012s-K4 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 21 Jun 2016 18:27:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFU8D-0008Jq-5G for qemu-devel@nongnu.org; Tue, 21 Jun 2016 18:26:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFU8A-00060b-TJ for qemu-devel@nongnu.org; Tue, 21 Jun 2016 18:26:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFU84-0005vt-3L; Tue, 21 Jun 2016 18:26:44 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46A291176A4; Tue, 21 Jun 2016 22:26:43 +0000 (UTC) Received: from [10.3.116.13] (ovpn-116-13.phx2.redhat.com [10.3.116.13]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5LMQgxg007260; Tue, 21 Jun 2016 18:26:42 -0400 To: Kevin Wolf References: <1465939839-30097-1-git-send-email-eblake@redhat.com> <1465939839-30097-18-git-send-email-eblake@redhat.com> <20160621141600.GJ4520@noname.redhat.com> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <5769BF22.8020907@redhat.com> Date: Tue, 21 Jun 2016 16:26:42 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20160621141600.GJ4520@noname.redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 21 Jun 2016 22:26:43 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [Qemu-devel] [PATCH v2 17/17] block: Move request_alignment into BlockLimit 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: Fam Zheng , Stefan Hajnoczi , qemu-block@nongnu.org, Peter Lieven , qemu-devel@nongnu.org, Max Reitz , Ronnie Sahlberg , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 06/21/2016 08:16 AM, Kevin Wolf wrote: > Am 14.06.2016 um 23:30 hat Eric Blake geschrieben: >> It makes more sense to have ALL block size limit constraints >> in the same struct. Improve the documentation while at it. >> >> Signed-off-by: Eric Blake >> >> --- >> struct BlockLimits { >> + /* Alignment requirement, in bytes, for offset/length of I/O >> + * requests. Must be a power of 2 less than INT_MAX. A value of 0 >> + * defaults to 1 for drivers with modern byte interfaces, and to >> + * 512 otherwise. */ > > No, a value of zero probably crashes qemu. The defaults apply when they > aren't overridden by the driver, but this field is always non-zero. > Then why does block.c have: be 0. Should I track that down and fix it first, so that request_alignment is always nonzero? If so, is using '1' for bdrv_is_sg(bs) the ideal solution? --- a/block.c +++ b/block.c @@ -1016,7 +1016,7 @@ static int bdrv_open_common(BlockDriverState *bs, BdrvChild *file, assert(bdrv_opt_mem_align(bs) != 0); assert(bdrv_min_mem_align(bs) != 0); - assert(is_power_of_2(bs->request_alignment) || bdrv_is_sg(bs)); + assert(is_power_of_2(bs->bl.request_alignment) || bdrv_is_sg(bs)); That says that if bdrv_is_sg(bs), we can indeed have request_alignment