From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXCnI-0007f6-Pk for qemu-devel@nongnu.org; Tue, 19 Jan 2010 07:02:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXCnE-0007cX-CS for qemu-devel@nongnu.org; Tue, 19 Jan 2010 07:02:48 -0500 Received: from [199.232.76.173] (port=50403 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXCnE-0007cU-5o for qemu-devel@nongnu.org; Tue, 19 Jan 2010 07:02:44 -0500 Received: from verein.lst.de ([213.95.11.210]:51271) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1NXCnD-0000Ur-FE for qemu-devel@nongnu.org; Tue, 19 Jan 2010 07:02:43 -0500 Date: Tue, 19 Jan 2010 13:02:41 +0100 From: Christoph Hellwig Subject: Re: [Qemu-devel] [PATCH 04/10] qcow2: Return 0/-errno in qcow2_alloc_cluster_offset Message-ID: <20100119120241.GA16260@lst.de> References: <1263816696-24122-1-git-send-email-kwolf@redhat.com> <1263816696-24122-5-git-send-email-kwolf@redhat.com> <20100119113547.GA14641@lst.de> <4B559E2F.9000309@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B559E2F.9000309@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Christoph Hellwig , qemu-devel@nongnu.org On Tue, Jan 19, 2010 at 12:57:35PM +0100, Kevin Wolf wrote: > It's needed to be able to distinguish between the case where the > clusters are already allocated (0/NULL) and the case where the request > depends on another one (0/non-NULL). This check previously used the > return value (cluster_offset for success, 0 for failure) and I didn't > want to overload m->cluster_offset with such a meaning. This is the > change in the caller: > > /* Need to wait for another request? If so, we are done for now. */ > - if (!acb->cluster_offset && acb->l2meta.depends_on != NULL) { > + if (acb->l2meta.nb_clusters == 0 && acb->l2meta.depends_on != NULL) { > > The alternative would have been to keep using the return value and > hijack some errno value. This would possibly conflict with real > read/write errors though, so I decided to leave the return value alone. Ok, makes sense.