qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Qcow2 allocate and free cluster
@ 2012-09-21  5:45 Gaurab Basu
  2012-10-05  8:07 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Gaurab Basu @ 2012-09-21  5:45 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

Hi,

I have a question regarding how the internal details of the qcow2 image is
managed.

My question is how the clusters are allocated. What I have understood, it
maintains a free_cluster_index to manage which host clusters are free.
In the function update_refcount(), if a cluster is freed it makes the
free_cluster_index point to that cluster. (if cluster_index <
free_cluster_index )
For allocating, in the function alloc_clusters_noref(), it uses the
free_cluster_index to search for free clusters.

So, suppose I have 1000 clusters which are all allocated, then while
freeing, the 2nd cluster gets freed, so the free_cluster_index points to
2nd cluster.
Now, if want to allocate 5 contiguous clusters, i have to search all the
way from 2 to 1000 before getting the 5 clusters.
Am I right in interpreting the mechanism?. If so, isn't it very slow to
search for all the clusters everytime.

Thanks and Regards,
Gaurab

[-- Attachment #2: Type: text/html, Size: 984 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-05  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21  5:45 [Qemu-devel] Qcow2 allocate and free cluster Gaurab Basu
2012-10-05  8:07 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).