On Tue 05 May 2015 01:20:19 PM CEST, Kevin Wolf wrote: > Though looking at the code again I see now that c->table_size isn't > consistently used. The I/O requests still use s->cluster_size. We > should either use it everywhere or not introduce it at all.
c->table_size is necessary in order to calculate the offset of a particular table, because s->cluster_size is not always available (e.g. qcow2_cache_entry_mark_dirty()). We could make it a requirement of the API, though. Alternatively we could have c->bs instead of c->table_size. That would spare us from passing the BlockDriverState pointer to all qcow2_cache_ functions. The assumption would be that the BlockDriverState pointer is the same for the whole lifetime of the cache, but that's always guaranteed to be like that, right? Berto