[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v6 7/8] vmdk: Update metadata for multiple clust
From: |
Ashijeet Acharya |
Subject: |
Re: [Qemu-block] [PATCH v6 7/8] vmdk: Update metadata for multiple clusters |
Date: |
Thu, 29 Jun 2017 14:18:44 +0530 |
On Tue, Jun 27, 2017 at 1:34 PM, Fam Zheng <address@hidden> wrote:
> On Mon, 06/05 13:22, Ashijeet Acharya wrote:
>> @@ -1876,6 +1942,13 @@ static int vmdk_pwritev(BlockDriverState *bs,
>> uint64_t offset,
>> offset += n_bytes;
>> bytes_done += n_bytes;
>>
>> + while (m_data->next != NULL) {
>
> If you do
>
> while (m_data) {
>
>> + VmdkMetaData *next;
>> + next = m_data->next;
>> + g_free(m_data);
>> + m_data = next;
>> + }
>> +
>> /* update CID on the first write every time the virtual disk is
>> * opened */
>> if (!s->cid_updated) {
>> @@ -1886,6 +1959,7 @@ static int vmdk_pwritev(BlockDriverState *bs, uint64_t
>> offset,
>> s->cid_updated = true;
>> }
>> }
>> + g_free(m_data);
>
> then you can remove this line.
As I explained last time, I can't do this because I am reusing the
first allocated m_data. If I am to do it the way you suggest, I will
have to move the allocation of first m_data (m_data =
g_new0(VmdkMetaData, 1)) inside the outer while loop, otherwise things
will segfault.
Ashijeet
- [Qemu-block] [PATCH v6 1/8] vmdk: Move vmdk_find_offset_in_cluster() to the top, (continued)
- [Qemu-block] [PATCH v6 1/8] vmdk: Move vmdk_find_offset_in_cluster() to the top, Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v6 2/8] vmdk: Rename get_whole_cluster() to vmdk_perform_cow(), Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v6 3/8] vmdk: Rename get_cluster_offset() to vmdk_get_cluster_offset(), Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v6 4/8] vmdk: Factor out metadata loading code out of vmdk_get_cluster_offset(), Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v6 5/8] vmdk: Set maximum bytes allocated in one cycle, Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v6 6/8] vmdk: New functions to assist allocating multiple clusters, Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v6 7/8] vmdk: Update metadata for multiple clusters, Ashijeet Acharya, 2017/06/05
- [Qemu-block] [PATCH v6 8/8] vmdk: Make vmdk_get_cluster_offset() return cluster offset only, Ashijeet Acharya, 2017/06/05