qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 25/32] qcow2: Update expand_zero_clusters_in_


From: Anton Nefedov
Subject: Re: [Qemu-devel] [PATCH v2 25/32] qcow2: Update expand_zero_clusters_in_l1() to support L2 slices
Date: Tue, 16 Jan 2018 19:54:45 +0300
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2



On 15/12/2017 3:53 PM, Alberto Garcia wrote:
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 8f7a04ba7d..ab840a449f 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
[..]
@@ -1907,124 +1911,133 @@ static int 
expand_zero_clusters_in_l1(BlockDriverState *bs, uint64_t *l1_table,
              goto fail;
          }
- if (is_active_l1) {
-            /* get active L2 tables from cache */
-            ret = qcow2_cache_get(bs, s->l2_table_cache, l2_offset,
-                    (void **)&l2_table);
-        } else {
-            /* load inactive L2 tables from disk */
-            ret = bdrv_read(bs->file, l2_offset / BDRV_SECTOR_SIZE,
-                            (void *)l2_table, s->cluster_sectors);
-        }
-        if (ret < 0) {
-            goto fail;
-        }
-
          ret = qcow2_get_refcount(bs, l2_offset >> s->cluster_bits,
                                   &l2_refcount);
          if (ret < 0) {
              goto fail;
          }
- for (j = 0; j < s->l2_size; j++) {
-            uint64_t l2_entry = be64_to_cpu(l2_table[j]);
-            int64_t offset = l2_entry & L2E_OFFSET_MASK;
-            QCow2ClusterType cluster_type = qcow2_get_cluster_type(l2_entry);
-
-            if (cluster_type != QCOW2_CLUSTER_ZERO_PLAIN &&
-                cluster_type != QCOW2_CLUSTER_ZERO_ALLOC) {
-                continue;
+        for (slice = 0; slice < n_slices; slice++) {
+            uint64_t slice_offset = l2_offset + slice * slice_size;

Seems like 'bool l2_dirty = false;' needs to be moved here.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]