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