Commit 49140a7748a6e8095cd93f2f58e33a9a8c78167b
1 parent
117b3ae6
Fix VMDK 2GB bug, by Filip Navara.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3158 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
1 additions
and
10 deletions
block-vmdk.c
@@ -520,7 +520,6 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, VmdkMetaData *m_data, | @@ -520,7 +520,6 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, VmdkMetaData *m_data, | ||
520 | int min_index, i, j; | 520 | int min_index, i, j; |
521 | uint32_t min_count, *l2_table, tmp = 0; | 521 | uint32_t min_count, *l2_table, tmp = 0; |
522 | uint64_t cluster_offset; | 522 | uint64_t cluster_offset; |
523 | - int status; | ||
524 | 523 | ||
525 | if (m_data) | 524 | if (m_data) |
526 | m_data->valid = 0; | 525 | m_data->valid = 0; |
@@ -564,19 +563,11 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, VmdkMetaData *m_data, | @@ -564,19 +563,11 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, VmdkMetaData *m_data, | ||
564 | cluster_offset = le32_to_cpu(l2_table[l2_index]); | 563 | cluster_offset = le32_to_cpu(l2_table[l2_index]); |
565 | 564 | ||
566 | if (!cluster_offset) { | 565 | if (!cluster_offset) { |
567 | - struct stat file_buf; | ||
568 | - | ||
569 | if (!allocate) | 566 | if (!allocate) |
570 | return 0; | 567 | return 0; |
571 | // Avoid the L2 tables update for the images that have snapshots. | 568 | // Avoid the L2 tables update for the images that have snapshots. |
572 | if (!s->is_parent) { | 569 | if (!s->is_parent) { |
573 | - status = stat(s->hd->filename, &file_buf); | ||
574 | - if (status == -1) { | ||
575 | - fprintf(stderr, "(VMDK) Fail file stat: filename =%s size=0x%llx errno=%s\n", | ||
576 | - s->hd->filename, (uint64_t)file_buf.st_size, strerror(errno)); | ||
577 | - return 0; | ||
578 | - } | ||
579 | - cluster_offset = file_buf.st_size; | 570 | + cluster_offset = bdrv_getlength(s->hd); |
580 | bdrv_truncate(s->hd, cluster_offset + (s->cluster_sectors << 9)); | 571 | bdrv_truncate(s->hd, cluster_offset + (s->cluster_sectors << 9)); |
581 | 572 | ||
582 | cluster_offset >>= 9; | 573 | cluster_offset >>= 9; |