From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTEkT-0005iO-1g for qemu-devel@nongnu.org; Thu, 27 Mar 2014 14:10:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTEkJ-0003tH-LO for qemu-devel@nongnu.org; Thu, 27 Mar 2014 14:09:52 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:40884 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTEkJ-0003t0-A8 for qemu-devel@nongnu.org; Thu, 27 Mar 2014 14:09:43 -0400 Message-ID: <53346963.2050004@kamp.de> Date: Thu, 27 Mar 2014 19:09:39 +0100 From: Peter Lieven MIME-Version: 1.0 References: <1395927818-26431-1-git-send-email-pl@kamp.de> <53343305.7000800@redhat.com> In-Reply-To: <53343305.7000800@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] block/iscsi: speed up read for unallocated sectors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: kwolf@redhat.com, ronniesahlberg@gmail.com, stefanha@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