From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Lieven <pl@kamp.de>, 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 15:17:41 +0100 [thread overview]
Message-ID: <53343305.7000800@redhat.com> (raw)
In-Reply-To: <1395927818-26431-1-git-send-email-pl@kamp.de>
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);
Paolo
next prev parent reply other threads:[~2014-03-27 14:18 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 [this message]
2014-03-27 18:09 ` Peter Lieven
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=53343305.7000800@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=pl@kamp.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).