[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 31/39] qcow2: Update qcow2_truncate() to supp
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-devel] [PATCH v3 31/39] qcow2: Update qcow2_truncate() to support L2 slices |
Date: |
Fri, 02 Feb 2018 11:10:27 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Thu 01 Feb 2018 08:46:46 PM CET, Max Reitz <address@hidden> wrote:
>> @@ -3261,8 +3261,9 @@ static int qcow2_truncate(BlockDriverState *bs,
>> int64_t offset,
>> guest_offset = old_length;
>> while (nb_new_data_clusters) {
>> int64_t guest_cluster = guest_offset >> s->cluster_bits;
>> - int64_t nb_clusters = MIN(nb_new_data_clusters,
>> - s->l2_size - guest_cluster %
>> s->l2_size);
>> + int64_t nb_clusters = MIN(
>> + nb_new_data_clusters,
>> + s->l2_slice_size - guest_cluster % s->l2_slice_size);
>
> An alternative would be the
> "s->l2_slice_size - offset_to_l2_slice_index(s, guest_offset)" we
> basically have elsewhere, but that's longer and doesn't really matter:
It's a bit longer but it looks better and we can get rid of
guest_cluster, so I think I'll change it.
Berto