Message ID | 1314105682-28396-16-git-send-email-freddy77@gmail.com |
---|---|
State | New |
Headers | show |
Am 23.08.2011 15:21, schrieb Frediano Ziglio: > Signed-off-by: Frediano Ziglio <freddy77@gmail.com> > --- > 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
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);
Signed-off-by: Frediano Ziglio <freddy77@gmail.com> --- block/qcow2-refcount.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)