From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qvsxt-0003db-JR for qemu-devel@nongnu.org; Tue, 23 Aug 2011 11:32:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qvsxs-00036Z-Pa for qemu-devel@nongnu.org; Tue, 23 Aug 2011 11:32:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qvsxs-00036R-Fg for qemu-devel@nongnu.org; Tue, 23 Aug 2011 11:32:32 -0400 Message-ID: <4E53C8C0.6000303@redhat.com> Date: Tue, 23 Aug 2011 17:35:28 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1314105682-28396-1-git-send-email-freddy77@gmail.com> <1314105682-28396-16-git-send-email-freddy77@gmail.com> In-Reply-To: <1314105682-28396-16-git-send-email-freddy77@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 15/15] qcow2: small optimization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Frediano Ziglio Cc: qemu-devel@nongnu.org Am 23.08.2011 15:21, schrieb Frediano Ziglio: > Signed-off-by: Frediano Ziglio > --- > block/qcow2-refcount.c | 11 +++++------ > 1 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c > index 0f9a64a..243c24b 100644 > --- a/block/qcow2-refcount.c > +++ b/block/qcow2-refcount.c > @@ -681,14 +681,13 @@ void qcow2_create_refcount_update(QCowCreateState *s, int64_t offset, > int64_t size) > { > int refcount; > - int64_t start, last, cluster_offset; > + int64_t start, last, cluster; > uint16_t *p; > > - start = offset & ~(s->cluster_size - 1); > - last = (offset + size - 1) & ~(s->cluster_size - 1); > - for(cluster_offset = start; cluster_offset <= last; > - cluster_offset += s->cluster_size) { > - p = &s->refcount_block[cluster_offset >> s->cluster_bits]; > + start = offset >> s->cluster_bits; > + last = (offset + size - 1) >> s->cluster_bits; > + for(cluster = start; cluster <= last; ++cluster) { > + p = &s->refcount_block[cluster]; > refcount = be16_to_cpu(*p); > refcount++; > *p = cpu_to_be16(refcount); This function is unused nowadays. I'd prefer a patch that removes it altogether. :-) Kevin