[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 15/15] qcow2: small optimization
From: |
Frediano Ziglio |
Subject: |
[Qemu-devel] [PATCH v2 15/15] qcow2: small optimization |
Date: |
Tue, 9 Aug 2011 09:46:50 +0200 |
Signed-off-by: Frediano Ziglio <address@hidden>
---
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 0e31868..318d66d 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);
--
1.7.1
- [Qemu-devel] [PATCH v2 05/15] qcow: remove old #undefined code, (continued)
- [Qemu-devel] [PATCH v2 05/15] qcow: remove old #undefined code, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 06/15] qcow2: removed unused fields, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 07/15] qcow2: removed cur_nr_sectors field in QCowAIOCB, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 08/15] qcow2: remove l2meta from QCowAIOCB, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 09/15] qcow2: remove cluster_offset from QCowAIOCB, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 11/15] qcow2: reindent and use while before the big jump, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 10/15] qcow2: remove common from QCowAIOCB, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 13/15] qcow2: remove memory leak, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 12/15] qcow2: removed QCowAIOCB entirely, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 14/15] qcow2: small math optimization, Frediano Ziglio, 2011/08/09
- [Qemu-devel] [PATCH v2 15/15] qcow2: small optimization,
Frediano Ziglio <=
- Re: [Qemu-devel] [PATCH v2 00/15] qcow/qcow2 cleanups, Kevin Wolf, 2011/08/22