[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] block/iscsi: speed up read for unallocated sect
From: |
Peter Lieven |
Subject: |
Re: [Qemu-devel] [PATCH] block/iscsi: speed up read for unallocated sectors |
Date: |
Thu, 27 Mar 2014 19:09:39 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
Am 27.03.2014 15:17, schrieb Paolo Bonzini:
> Il 27/03/2014 14:43, Peter Lieven ha scritto:
>>
>> +static void iscsi_allocationmap_set(IscsiLun *iscsilun, int64_t sector_num,
>> + int nb_sectors)
>> +{
>> + if (!iscsilun->cluster_sectors) {
>> + return;
>> + }
>> + bitmap_set(iscsilun->allocationmap,
>> + sector_num / iscsilun->cluster_sectors,
>> + DIV_ROUND_UP(nb_sectors, iscsilun->cluster_sectors));
>> +}
>> +
>> +static void iscsi_allocationmap_clear(IscsiLun *iscsilun, int64_t
>> sector_num,
>> + int nb_sectors)
>> +{
>> + if (!iscsilun->cluster_sectors) {
>> + return;
>> + }
>> + bitmap_clear(iscsilun->allocationmap,
>> + sector_num / iscsilun->cluster_sectors,
>> + DIV_ROUND_UP(nb_sectors, iscsilun->cluster_sectors));
>> +}
>> +
>
> Here you need to round the other way, because partial clusters are not
> unmapped:
>
> cluster_num = DIV_ROUND_UP(sector_num, iscsi->cluster_sectors);
> nb_clusters = (sector_num + nb_sectors) / iscsi->cluster_sectors
> - cluster_num;
> bitmap_clear(iscsilun->allocationmap, cluster_num, nb_clusters);
Right, its not criticial because the allocationmap is more a hint, but its
worth correcting
this. I have to check if bitmap_clear can cope with nb_clusters == 0.
thank you,
Peter
>
> Paolo