All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alberto Garcia <berto@igalia.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anton Nefedov <anton.nefedov@virtuozzo.com>,
	Alberto Garcia <berto@igalia.com>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>,
	"Denis V . Lunev" <den@openvz.org>
Subject: [RFC PATCH 16/23] qcow2: Add subcluster support to discard_in_l2_slice()
Date: Tue, 15 Oct 2019 18:23:27 +0300	[thread overview]
Message-ID: <cb5c8e7005ba04d057d1b394309997c302e8658c.1571152571.git.berto@igalia.com> (raw)
In-Reply-To: <cover.1571152571.git.berto@igalia.com>

Setting the QCOW_OFLAG_ZERO bit of the L2 entry is forbidden if an
image has subclusters. Instead, the individual 'all zeroes' bits must
be used.

Signed-off-by: Alberto Garcia <berto@igalia.com>
---
 block/qcow2-cluster.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index c554b1a88c..bf32447d18 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1769,7 +1769,11 @@ static int discard_in_l2_slice(BlockDriverState *bs, uint64_t offset,
 
         /* First remove L2 entries */
         qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_slice);
-        if (!full_discard && s->qcow_version >= 3) {
+        if (has_subclusters(s)) {
+            set_l2_entry(s, l2_slice, l2_index + i, 0);
+            set_l2_bitmap(s, l2_slice, l2_index + i,
+                          full_discard ? 0 : QCOW_L2_BITMAP_ALL_ZEROES);
+        } else if (!full_discard && s->qcow_version >= 3) {
             set_l2_entry(s, l2_slice, l2_index + i, QCOW_OFLAG_ZERO);
         } else {
             set_l2_entry(s, l2_slice, l2_index + i, 0);
-- 
2.20.1



  parent reply	other threads:[~2019-10-15 15:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 15:23 [RFC PATCH 00/23] Add subcluster allocation to qcow2 Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 01/23] qcow2: Add calculate_l2_meta() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 02/23] qcow2: Split cluster_needs_cow() out of count_cow_clusters() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 03/23] qcow2: Process QCOW2_CLUSTER_ZERO_ALLOC clusters in handle_copied() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 04/23] qcow2: Add get_l2_entry() and set_l2_entry() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 05/23] qcow2: Document the Extended L2 Entries feature Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 06/23] qcow2: Add dummy has_subclusters() function Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 07/23] qcow2: Add subcluster-related fields to BDRVQcow2State Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 08/23] qcow2: Add offset_to_sc_index() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 09/23] qcow2: Add l2_entry_size() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 10/23] qcow2: Update get/set_l2_entry() and add get/set_l2_bitmap() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 11/23] qcow2: Add qcow2_get_subcluster_type() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 12/23] qcow2: Handle QCOW2_CLUSTER_UNALLOCATED_SUBCLUSTER Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 13/23] qcow2: Add subcluster support to calculate_l2_meta() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 14/23] qcow2: Add subcluster support to qcow2_get_cluster_offset() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 15/23] qcow2: Add subcluster support to zero_in_l2_slice() Alberto Garcia
2019-10-15 15:23 ` Alberto Garcia [this message]
2019-10-15 15:23 ` [RFC PATCH 17/23] qcow2: Add subcluster support to check_refcounts_l2() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 18/23] qcow2: Add subcluster support to expand_zero_clusters_in_l1() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 19/23] qcow2: Fix offset calculation in handle_dependencies() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 20/23] qcow2: Update L2 bitmap in qcow2_alloc_cluster_link_l2() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 21/23] qcow2: Add subcluster support to handle_alloc_space() Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 22/23] qcow2: Restrict qcow2_co_pwrite_zeroes() to full clusters only Alberto Garcia
2019-10-15 15:23 ` [RFC PATCH 23/23] qcow2: Add the 'extended_l2' option and the QCOW2_INCOMPAT_EXTL2 bit Alberto Garcia
2019-10-15 15:42   ` Eric Blake
2019-10-15 16:05 ` [RFC PATCH 00/23] Add subcluster allocation to qcow2 Eric Blake
2019-10-16  7:14   ` Alberto Garcia
2019-10-23 10:39 ` Vladimir Sementsov-Ogievskiy
2019-10-26 21:26   ` Alberto Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb5c8e7005ba04d057d1b394309997c302e8658c.1571152571.git.berto@igalia.com \
    --to=berto@igalia.com \
    --cc=anton.nefedov@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.