Commit 943984c7a508a2d76029e8065b2c2564d279892f
1 parent
b7ea8c26
Revert r6404
This series is broken by design as it requires expensive IO operations at open time causing very long delays when starting a virtual machine for the first time. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6816 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
0 additions
and
34 deletions
block-qcow2.c
... | ... | @@ -143,9 +143,6 @@ typedef struct BDRVQcowState { |
143 | 143 | uint32_t crypt_method_header; |
144 | 144 | AES_KEY aes_encrypt_key; |
145 | 145 | AES_KEY aes_decrypt_key; |
146 | - | |
147 | - int64_t highest_alloc; /* highest cluester allocated (in clusters) */ | |
148 | - | |
149 | 146 | uint64_t snapshots_offset; |
150 | 147 | int snapshots_size; |
151 | 148 | int nb_snapshots; |
... | ... | @@ -173,8 +170,6 @@ static void free_clusters(BlockDriverState *bs, |
173 | 170 | #ifdef DEBUG_ALLOC |
174 | 171 | static void check_refcounts(BlockDriverState *bs); |
175 | 172 | #endif |
176 | -static void scan_refcount(BlockDriverState *bs, int64_t *high); | |
177 | - | |
178 | 173 | |
179 | 174 | static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename) |
180 | 175 | { |
... | ... | @@ -275,8 +270,6 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) |
275 | 270 | if (refcount_init(bs) < 0) |
276 | 271 | goto fail; |
277 | 272 | |
278 | - scan_refcount(bs, &s->highest_alloc); | |
279 | - | |
280 | 273 | /* read the backing file name */ |
281 | 274 | if (header.backing_file_offset != 0) { |
282 | 275 | len = header.backing_file_size; |
... | ... | @@ -2163,29 +2156,6 @@ static int load_refcount_block(BlockDriverState *bs, |
2163 | 2156 | return 0; |
2164 | 2157 | } |
2165 | 2158 | |
2166 | -static void scan_refcount(BlockDriverState *bs, int64_t *high) | |
2167 | -{ | |
2168 | - BDRVQcowState *s = bs->opaque; | |
2169 | - int64_t refcnt_index, cluster_index, cluster_end, h = 0; | |
2170 | - | |
2171 | - for (refcnt_index=0; refcnt_index < s->refcount_table_size; refcnt_index++){ | |
2172 | - if (s->refcount_table[refcnt_index] == 0) { | |
2173 | - continue; | |
2174 | - } | |
2175 | - cluster_index = refcnt_index << (s->cluster_bits - REFCOUNT_SHIFT); | |
2176 | - cluster_end = (refcnt_index + 1) << (s->cluster_bits - REFCOUNT_SHIFT); | |
2177 | - for ( ; cluster_index < cluster_end; cluster_index++) { | |
2178 | - if (get_refcount(bs, cluster_index) == 0) | |
2179 | - /* do nothing -- reserved for free counting */; | |
2180 | - else | |
2181 | - h = cluster_index; | |
2182 | - } | |
2183 | - } | |
2184 | - | |
2185 | - if (high) | |
2186 | - *high = (h+1); | |
2187 | -} | |
2188 | - | |
2189 | 2159 | static int get_refcount(BlockDriverState *bs, int64_t cluster_index) |
2190 | 2160 | { |
2191 | 2161 | BDRVQcowState *s = bs->opaque; |
... | ... | @@ -2226,10 +2196,6 @@ retry: |
2226 | 2196 | size, |
2227 | 2197 | (s->free_cluster_index - nb_clusters) << s->cluster_bits); |
2228 | 2198 | #endif |
2229 | - | |
2230 | - if (s->highest_alloc < s->free_cluster_index) | |
2231 | - s->highest_alloc = s->free_cluster_index; | |
2232 | - | |
2233 | 2199 | return (s->free_cluster_index - nb_clusters) << s->cluster_bits; |
2234 | 2200 | } |
2235 | 2201 | ... | ... |