|
|
218e99 |
From 92803fbc4c637faa21cc28e77ca400d9427f2554 Mon Sep 17 00:00:00 2001
|
|
|
218e99 |
From: Fam Zheng <famz@redhat.com>
|
|
|
218e99 |
Date: Tue, 6 Aug 2013 15:44:55 +0800
|
|
|
218e99 |
Subject: [PATCH 09/13] vmdk: rename num_gtes_per_gte to num_gtes_per_gt
|
|
|
218e99 |
|
|
|
218e99 |
Message-id: <1377573001-27070-10-git-send-email-famz@redhat.com>
|
|
|
218e99 |
Patchwork-id: 53789
|
|
|
218e99 |
O-Subject: [RHEL-7 qemu-kvm PATCH 09/13] vmdk: rename num_gtes_per_gte to
|
|
|
218e99 |
num_gtes_per_gt
|
|
|
218e99 |
Bugzilla: 995866
|
|
|
218e99 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
218e99 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
218e99 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
218e99 |
|
|
|
218e99 |
num_gtes_per_gte is a historical typo, rename it to a more sensible
|
|
|
218e99 |
name. It means "number of GrainTableEntries per GrainTable".
|
|
|
218e99 |
|
|
|
218e99 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
218e99 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
218e99 |
(cherry picked from commit ca8804ced9fdba7a1925ed81084dfb7a5b6ffa9f)
|
|
|
218e99 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
218e99 |
---
|
|
|
218e99 |
block/vmdk.c | 17 +++++++++--------
|
|
|
218e99 |
1 files changed, 9 insertions(+), 8 deletions(-)
|
|
|
218e99 |
|
|
|
218e99 |
diff --git a/block/vmdk.c b/block/vmdk.c
|
|
|
218e99 |
index 1af6122..73d9907 100644
|
|
|
218e99 |
--- a/block/vmdk.c
|
|
|
218e99 |
+++ b/block/vmdk.c
|
|
|
218e99 |
@@ -71,7 +71,8 @@ typedef struct {
|
|
|
218e99 |
uint64_t granularity;
|
|
|
218e99 |
uint64_t desc_offset;
|
|
|
218e99 |
uint64_t desc_size;
|
|
|
218e99 |
- uint32_t num_gtes_per_gte;
|
|
|
218e99 |
+ /* Number of GrainTableEntries per GrainTable */
|
|
|
218e99 |
+ uint32_t num_gtes_per_gt;
|
|
|
218e99 |
uint64_t rgd_offset;
|
|
|
218e99 |
uint64_t gd_offset;
|
|
|
218e99 |
uint64_t grain_offset;
|
|
|
218e99 |
@@ -585,12 +586,12 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
|
|
|
218e99 |
return -ENOTSUP;
|
|
|
218e99 |
}
|
|
|
218e99 |
|
|
|
218e99 |
- if (le32_to_cpu(header.num_gtes_per_gte) > 512) {
|
|
|
218e99 |
+ if (le32_to_cpu(header.num_gtes_per_gt) > 512) {
|
|
|
218e99 |
error_report("L2 table size too big");
|
|
|
218e99 |
return -EINVAL;
|
|
|
218e99 |
}
|
|
|
218e99 |
|
|
|
218e99 |
- l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gte)
|
|
|
218e99 |
+ l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gt)
|
|
|
218e99 |
* le64_to_cpu(header.granularity);
|
|
|
218e99 |
if (l1_entry_sectors == 0) {
|
|
|
218e99 |
return -EINVAL;
|
|
|
218e99 |
@@ -613,7 +614,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
|
|
|
218e99 |
le64_to_cpu(header.gd_offset) << 9,
|
|
|
218e99 |
l1_backup_offset,
|
|
|
218e99 |
l1_size,
|
|
|
218e99 |
- le32_to_cpu(header.num_gtes_per_gte),
|
|
|
218e99 |
+ le32_to_cpu(header.num_gtes_per_gt),
|
|
|
218e99 |
le64_to_cpu(header.granularity),
|
|
|
218e99 |
&extent);
|
|
|
218e99 |
if (ret < 0) {
|
|
|
218e99 |
@@ -1411,12 +1412,12 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
|
|
218e99 |
header.compressAlgorithm = compress ? VMDK4_COMPRESSION_DEFLATE : 0;
|
|
|
218e99 |
header.capacity = filesize / 512;
|
|
|
218e99 |
header.granularity = 128;
|
|
|
218e99 |
- header.num_gtes_per_gte = 512;
|
|
|
218e99 |
+ header.num_gtes_per_gt = 512;
|
|
|
218e99 |
|
|
|
218e99 |
grains = (filesize / 512 + header.granularity - 1) / header.granularity;
|
|
|
218e99 |
- gt_size = ((header.num_gtes_per_gte * sizeof(uint32_t)) + 511) >> 9;
|
|
|
218e99 |
+ gt_size = ((header.num_gtes_per_gt * sizeof(uint32_t)) + 511) >> 9;
|
|
|
218e99 |
gt_count =
|
|
|
218e99 |
- (grains + header.num_gtes_per_gte - 1) / header.num_gtes_per_gte;
|
|
|
218e99 |
+ (grains + header.num_gtes_per_gt - 1) / header.num_gtes_per_gt;
|
|
|
218e99 |
gd_size = (gt_count * sizeof(uint32_t) + 511) >> 9;
|
|
|
218e99 |
|
|
|
218e99 |
header.desc_offset = 1;
|
|
|
218e99 |
@@ -1432,7 +1433,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
|
|
218e99 |
header.flags = cpu_to_le32(header.flags);
|
|
|
218e99 |
header.capacity = cpu_to_le64(header.capacity);
|
|
|
218e99 |
header.granularity = cpu_to_le64(header.granularity);
|
|
|
218e99 |
- header.num_gtes_per_gte = cpu_to_le32(header.num_gtes_per_gte);
|
|
|
218e99 |
+ header.num_gtes_per_gt = cpu_to_le32(header.num_gtes_per_gt);
|
|
|
218e99 |
header.desc_offset = cpu_to_le64(header.desc_offset);
|
|
|
218e99 |
header.desc_size = cpu_to_le64(header.desc_size);
|
|
|
218e99 |
header.rgd_offset = cpu_to_le64(header.rgd_offset);
|
|
|
218e99 |
--
|
|
|
218e99 |
1.7.1
|
|
|
218e99 |
|