Revision 5d757b56 block/qcow2-refcount.c
b/block/qcow2-refcount.c | ||
---|---|---|
435 | 435 |
assert(size > 0 && size <= s->cluster_size); |
436 | 436 |
if (s->free_byte_offset == 0) { |
437 | 437 |
s->free_byte_offset = qcow2_alloc_clusters(bs, s->cluster_size); |
438 |
if (s->free_byte_offset < 0) { |
|
439 |
return s->free_byte_offset; |
|
440 |
} |
|
438 | 441 |
} |
439 | 442 |
redo: |
440 | 443 |
free_in_cluster = s->cluster_size - |
... | ... | |
450 | 453 |
update_cluster_refcount(bs, offset >> s->cluster_bits, 1); |
451 | 454 |
} else { |
452 | 455 |
offset = qcow2_alloc_clusters(bs, s->cluster_size); |
456 |
if (offset < 0) { |
|
457 |
return offset; |
|
458 |
} |
|
453 | 459 |
cluster_offset = s->free_byte_offset & ~(s->cluster_size - 1); |
454 | 460 |
if ((cluster_offset + s->cluster_size) == offset) { |
455 | 461 |
/* we are lucky: contiguous data */ |
Also available in: Unified diff