All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Lieven <pl@kamp.de>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, ronniesahlberg@gmail.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] block/iscsi: speed up read for unallocated sectors
Date: Thu, 27 Mar 2014 19:09:39 +0100	[thread overview]
Message-ID: <53346963.2050004@kamp.de> (raw)
In-Reply-To: <53343305.7000800@redhat.com>

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

      reply	other threads:[~2014-03-27 18:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 13:43 [Qemu-devel] [PATCH] block/iscsi: speed up read for unallocated sectors Peter Lieven
2014-03-27 14:17 ` Paolo Bonzini
2014-03-27 18:09   ` Peter Lieven [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53346963.2050004@kamp.de \
    --to=pl@kamp.de \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.