From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1yRH-0004kF-9z for qemu-devel@nongnu.org; Mon, 08 Jun 2015 10:54:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1yRG-00034L-I3 for qemu-devel@nongnu.org; Mon, 08 Jun 2015 10:54:11 -0400 Message-ID: <5575AC85.7020101@redhat.com> Date: Mon, 08 Jun 2015 16:53:57 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1433759662-25139-1-git-send-email-famz@redhat.com> <1433759662-25139-2-git-send-email-famz@redhat.com> <5575A402.3040301@redhat.com> In-Reply-To: <5575A402.3040301@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/3] block: Extrace bdrv_parse_detect_zeroes_flags List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , stefanha@redhat.com, Markus Armbruster , qemu-block@nongnu.org On 08/06/2015 16:17, Eric Blake wrote: >> > + >> > + if (detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP && >> > + !(bdrv_flags & BDRV_O_UNMAP)) { >> > + error_setg(errp, "setting detect-zeroes to unmap is not allowed " >> > + "without setting discard operation to unmap"); >> > + } > I think it might be better to have a tri-state enum, than to have two > competing bools where only 3 of the 4 states are valid. Note that this is not a bool. We have one bool and one 3-element enum (off/on/unmap), where only 5 of the 6 states are valid. Also, at least detect-zeroes would go away if we had some kind of blockdev-mirror (where the target is added first with blockdev-add), so I think it's better to leave it separate. Paolo