qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 04/10] qcow2: Return 0/-errno in qcow2_alloc_clu


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH 04/10] qcow2: Return 0/-errno in qcow2_alloc_cluster_offset
Date: Tue, 19 Jan 2010 12:57:35 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-3.fc11 Thunderbird/3.0

Am 19.01.2010 12:35, schrieb Christoph Hellwig:
>> @@ -715,6 +721,7 @@ uint64_t qcow2_alloc_cluster_offset(BlockDriverState *bs,
>>  
>>          cluster_offset &= ~QCOW_OFLAG_COPIED;
>>          m->nb_clusters = 0;
>> +        m->depends_on = NULL;
> 
> What does this have to do with the rest?

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.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]