* [Qemu-devel] [PATCH v2] vmdk: fix metadata write regression
@ 2016-07-07 8:42 Reda Sallahi
2016-07-07 8:54 ` Fam Zheng
2016-07-08 13:26 ` Max Reitz
0 siblings, 2 replies; 3+ messages in thread
From: Reda Sallahi @ 2016-07-07 8:42 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Fam Zheng, Kevin Wolf, Max Reitz, Reda Sallahi
Commit "cdeaf1f vmdk: add bdrv_co_write_zeroes" causes a regression on
writes. It writes metadata after every write instead of doing it only once
for each cluster.
vmdk_pwritev() writes metadata whenever m_data is set as valid so this patch
sets m_data as valid only when we have a new cluster which hasn't been
allocated before or a zero grain.
Signed-off-by: Reda Sallahi <fullmanet@gmail.com>
---
v2: Corrected the commit id referenced in the commit message.
block/vmdk.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index d73f431..1cbd487 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1202,13 +1202,6 @@ static int get_cluster_offset(BlockDriverState *bs,
l2_index = ((offset >> 9) / extent->cluster_sectors) % extent->l2_size;
cluster_sector = le32_to_cpu(l2_table[l2_index]);
- if (m_data) {
- m_data->valid = 1;
- m_data->l1_index = l1_index;
- m_data->l2_index = l2_index;
- m_data->l2_offset = l2_offset;
- m_data->l2_cache_entry = &l2_table[l2_index];
- }
if (extent->has_zero_grain && cluster_sector == VMDK_GTE_ZEROED) {
zeroed = true;
}
@@ -1231,6 +1224,13 @@ static int get_cluster_offset(BlockDriverState *bs,
if (ret) {
return ret;
}
+ if (m_data) {
+ m_data->valid = 1;
+ m_data->l1_index = l1_index;
+ m_data->l2_index = l2_index;
+ m_data->l2_offset = l2_offset;
+ m_data->l2_cache_entry = &l2_table[l2_index];
+ }
}
*cluster_offset = cluster_sector << BDRV_SECTOR_BITS;
return VMDK_OK;
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] vmdk: fix metadata write regression
2016-07-07 8:42 [Qemu-devel] [PATCH v2] vmdk: fix metadata write regression Reda Sallahi
@ 2016-07-07 8:54 ` Fam Zheng
2016-07-08 13:26 ` Max Reitz
1 sibling, 0 replies; 3+ messages in thread
From: Fam Zheng @ 2016-07-07 8:54 UTC (permalink / raw)
To: Reda Sallahi; +Cc: qemu-devel, qemu-block, Kevin Wolf, Max Reitz
On Thu, 07/07 10:42, Reda Sallahi wrote:
> Commit "cdeaf1f vmdk: add bdrv_co_write_zeroes" causes a regression on
> writes. It writes metadata after every write instead of doing it only once
> for each cluster.
>
> vmdk_pwritev() writes metadata whenever m_data is set as valid so this patch
> sets m_data as valid only when we have a new cluster which hasn't been
> allocated before or a zero grain.
>
> Signed-off-by: Reda Sallahi <fullmanet@gmail.com>
> ---
> v2: Corrected the commit id referenced in the commit message.
>
> block/vmdk.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/block/vmdk.c b/block/vmdk.c
> index d73f431..1cbd487 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -1202,13 +1202,6 @@ static int get_cluster_offset(BlockDriverState *bs,
> l2_index = ((offset >> 9) / extent->cluster_sectors) % extent->l2_size;
> cluster_sector = le32_to_cpu(l2_table[l2_index]);
>
> - if (m_data) {
> - m_data->valid = 1;
> - m_data->l1_index = l1_index;
> - m_data->l2_index = l2_index;
> - m_data->l2_offset = l2_offset;
> - m_data->l2_cache_entry = &l2_table[l2_index];
> - }
> if (extent->has_zero_grain && cluster_sector == VMDK_GTE_ZEROED) {
> zeroed = true;
> }
> @@ -1231,6 +1224,13 @@ static int get_cluster_offset(BlockDriverState *bs,
> if (ret) {
> return ret;
> }
> + if (m_data) {
> + m_data->valid = 1;
> + m_data->l1_index = l1_index;
> + m_data->l2_index = l2_index;
> + m_data->l2_offset = l2_offset;
> + m_data->l2_cache_entry = &l2_table[l2_index];
> + }
> }
> *cluster_offset = cluster_sector << BDRV_SECTOR_BITS;
> return VMDK_OK;
> --
> 2.9.0
>
Looks good, nice catch!
Reviewed-by: Fam Zheng <famz@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] vmdk: fix metadata write regression
2016-07-07 8:42 [Qemu-devel] [PATCH v2] vmdk: fix metadata write regression Reda Sallahi
2016-07-07 8:54 ` Fam Zheng
@ 2016-07-08 13:26 ` Max Reitz
1 sibling, 0 replies; 3+ messages in thread
From: Max Reitz @ 2016-07-08 13:26 UTC (permalink / raw)
To: Reda Sallahi, qemu-devel; +Cc: qemu-block, Fam Zheng, Kevin Wolf
[-- Attachment #1: Type: text/plain, Size: 749 bytes --]
On 07.07.2016 10:42, Reda Sallahi wrote:
> Commit "cdeaf1f vmdk: add bdrv_co_write_zeroes" causes a regression on
> writes. It writes metadata after every write instead of doing it only once
> for each cluster.
>
> vmdk_pwritev() writes metadata whenever m_data is set as valid so this patch
> sets m_data as valid only when we have a new cluster which hasn't been
> allocated before or a zero grain.
>
> Signed-off-by: Reda Sallahi <fullmanet@gmail.com>
> ---
> v2: Corrected the commit id referenced in the commit message.
>
> block/vmdk.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Thanks Reda, I've applied the patch to my block branch:
https://github.com/XanClic/qemu/commits/block
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 498 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-08 13:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07 8:42 [Qemu-devel] [PATCH v2] vmdk: fix metadata write regression Reda Sallahi
2016-07-07 8:54 ` Fam Zheng
2016-07-08 13:26 ` Max Reitz
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.