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,9 +143,6 @@ typedef struct BDRVQcowState { | ||
143 | uint32_t crypt_method_header; | 143 | uint32_t crypt_method_header; |
144 | AES_KEY aes_encrypt_key; | 144 | AES_KEY aes_encrypt_key; |
145 | AES_KEY aes_decrypt_key; | 145 | AES_KEY aes_decrypt_key; |
146 | - | ||
147 | - int64_t highest_alloc; /* highest cluester allocated (in clusters) */ | ||
148 | - | ||
149 | uint64_t snapshots_offset; | 146 | uint64_t snapshots_offset; |
150 | int snapshots_size; | 147 | int snapshots_size; |
151 | int nb_snapshots; | 148 | int nb_snapshots; |
@@ -173,8 +170,6 @@ static void free_clusters(BlockDriverState *bs, | @@ -173,8 +170,6 @@ static void free_clusters(BlockDriverState *bs, | ||
173 | #ifdef DEBUG_ALLOC | 170 | #ifdef DEBUG_ALLOC |
174 | static void check_refcounts(BlockDriverState *bs); | 171 | static void check_refcounts(BlockDriverState *bs); |
175 | #endif | 172 | #endif |
176 | -static void scan_refcount(BlockDriverState *bs, int64_t *high); | ||
177 | - | ||
178 | 173 | ||
179 | static int qcow_probe(const uint8_t *buf, int buf_size, const char *filename) | 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,8 +270,6 @@ static int qcow_open(BlockDriverState *bs, const char *filename, int flags) | ||
275 | if (refcount_init(bs) < 0) | 270 | if (refcount_init(bs) < 0) |
276 | goto fail; | 271 | goto fail; |
277 | 272 | ||
278 | - scan_refcount(bs, &s->highest_alloc); | ||
279 | - | ||
280 | /* read the backing file name */ | 273 | /* read the backing file name */ |
281 | if (header.backing_file_offset != 0) { | 274 | if (header.backing_file_offset != 0) { |
282 | len = header.backing_file_size; | 275 | len = header.backing_file_size; |
@@ -2163,29 +2156,6 @@ static int load_refcount_block(BlockDriverState *bs, | @@ -2163,29 +2156,6 @@ static int load_refcount_block(BlockDriverState *bs, | ||
2163 | return 0; | 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 | static int get_refcount(BlockDriverState *bs, int64_t cluster_index) | 2159 | static int get_refcount(BlockDriverState *bs, int64_t cluster_index) |
2190 | { | 2160 | { |
2191 | BDRVQcowState *s = bs->opaque; | 2161 | BDRVQcowState *s = bs->opaque; |
@@ -2226,10 +2196,6 @@ retry: | @@ -2226,10 +2196,6 @@ retry: | ||
2226 | size, | 2196 | size, |
2227 | (s->free_cluster_index - nb_clusters) << s->cluster_bits); | 2197 | (s->free_cluster_index - nb_clusters) << s->cluster_bits); |
2228 | #endif | 2198 | #endif |
2229 | - | ||
2230 | - if (s->highest_alloc < s->free_cluster_index) | ||
2231 | - s->highest_alloc = s->free_cluster_index; | ||
2232 | - | ||
2233 | return (s->free_cluster_index - nb_clusters) << s->cluster_bits; | 2199 | return (s->free_cluster_index - nb_clusters) << s->cluster_bits; |
2234 | } | 2200 | } |
2235 | 2201 |