From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: [PATCH 1/6] vmdk: Rename VmdkMetaData.valid to new_allocation
Date: Thu, 30 Apr 2020 15:30:02 +0200 [thread overview]
Message-ID: <20200430133007.170335-2-kwolf@redhat.com> (raw)
In-Reply-To: <20200430133007.170335-1-kwolf@redhat.com>
m_data is used for zero clusters even though valid == 0. It really only
means that a new cluster was allocated in the image file. Rename it to
reflect this.
While at it, change it from int to bool, too.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/vmdk.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 8ec18f35a5..5b09275578 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -180,7 +180,7 @@ typedef struct VmdkMetaData {
unsigned int l1_index;
unsigned int l2_index;
unsigned int l2_offset;
- int valid;
+ bool new_allocation;
uint32_t *l2_cache_entry;
} VmdkMetaData;
@@ -1492,7 +1492,7 @@ static int get_cluster_offset(BlockDriverState *bs,
unsigned int l2_size_bytes = extent->l2_size * extent->entry_size;
if (m_data) {
- m_data->valid = 0;
+ m_data->new_allocation = false;
}
if (extent->flat) {
*cluster_offset = extent->flat_start_offset;
@@ -1630,7 +1630,7 @@ static int get_cluster_offset(BlockDriverState *bs,
return ret;
}
if (m_data) {
- m_data->valid = 1;
+ m_data->new_allocation = true;
m_data->l1_index = l1_index;
m_data->l2_index = l2_index;
m_data->l2_offset = l2_offset;
@@ -2021,7 +2021,7 @@ static int vmdk_pwritev(BlockDriverState *bs, uint64_t offset,
if (ret) {
return ret;
}
- if (m_data.valid) {
+ if (m_data.new_allocation) {
/* update L2 tables */
if (vmdk_L2update(extent, &m_data,
cluster_offset >> BDRV_SECTOR_BITS)
--
2.25.3
next prev parent reply other threads:[~2020-04-30 13:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 13:30 [PATCH 0/6] vmdk: Fix zero cluster handling Kevin Wolf
2020-04-30 13:30 ` Kevin Wolf [this message]
2020-04-30 14:10 ` [PATCH 1/6] vmdk: Rename VmdkMetaData.valid to new_allocation Eric Blake
2020-04-30 13:30 ` [PATCH 2/6] vmdk: Fix zero cluster allocation Kevin Wolf
2020-04-30 14:14 ` Eric Blake
2020-04-30 14:19 ` Eric Blake
2020-04-30 14:32 ` Kevin Wolf
2020-04-30 13:30 ` [PATCH 3/6] vmdk: Fix partial overwrite of zero cluster Kevin Wolf
2020-04-30 14:16 ` Eric Blake
2020-04-30 13:30 ` [PATCH 4/6] vmdk: Don't update L2 table for zero write on " Kevin Wolf
2020-04-30 14:17 ` Eric Blake
2020-04-30 13:30 ` [PATCH 5/6] vmdk: Flush only once in vmdk_L2update() Kevin Wolf
2020-04-30 14:18 ` Eric Blake
2020-04-30 13:30 ` [PATCH 6/6] iotests: vmdk: Enable zeroed_grained=on by default Kevin Wolf
2020-04-30 14:22 ` Eric Blake
2020-04-30 14:42 ` Kevin Wolf
2020-05-05 9:42 ` [PATCH 0/6] vmdk: Fix zero cluster handling Kevin Wolf
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=20200430133007.170335-2-kwolf@redhat.com \
--to=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.