On 07.05.2017 02:05, Eric Blake wrote: > In order to keep checkpatch happy when the next patch changes > indentation, we first have to shorten some long lines. The easiest > approach is to use a new variable in place of > 'offset & L2E_OFFSET_MASK', except that 'offset' is the best name > for that variable. Change '[old_]offset' to '[old_]entry' to > make room. > > While touching things, also fix checkpatch warnings about unusual > 'for' statements. > > Suggested by Max Reitz <[email protected]> > Signed-off-by: Eric Blake <[email protected]> > > --- > v13: new patch > --- > block/qcow2-refcount.c | 42 ++++++++++++++++++++++-------------------- > 1 file changed, 22 insertions(+), 20 deletions(-) > > diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c > index 4efca7e..db0af2c 100644 > --- a/block/qcow2-refcount.c > +++ b/block/qcow2-refcount.c
[...]
> @@ -1117,20 +1118,22 @@ int qcow2_update_snapshot_refcount(BlockDriverState
> *bs,
> goto fail;
> }
>
> - for(j = 0; j < s->l2_size; j++) {
> + for (j = 0; j < s->l2_size; j++) {
> uint64_t cluster_index;
> + uint64_t offset;
Actually, introducing entry and old_entry in this scope would have
sufficed, too, because they aren't used anywhere else. But nobody
actually cares (O:-)), so:
Reviewed-by: Max Reitz <[email protected]>
>
> - offset = be64_to_cpu(l2_table[j]);
> - old_offset = offset;
> - offset &= ~QCOW_OFLAG_COPIED;
> + entry = be64_to_cpu(l2_table[j]);
> + old_entry = entry;
> + entry &= ~QCOW_OFLAG_COPIED;
> + offset = entry & L2E_OFFSET_MASK;
>
> - switch (qcow2_get_cluster_type(offset)) {
> + switch (qcow2_get_cluster_type(entry)) {
> case QCOW2_CLUSTER_COMPRESSED:
> - nb_csectors = ((offset >> s->csize_shift) &
> + nb_csectors = ((entry >> s->csize_shift) &
> s->csize_mask) + 1;
> if (addend != 0) {
> ret = update_refcount(bs,
> - (offset & s->cluster_offset_mask) & ~511,
> + (entry & s->cluster_offset_mask) & ~511,
> nb_csectors * 512, abs(addend), addend < 0,
> QCOW2_DISCARD_SNAPSHOT);
> if (ret < 0) {
signature.asc
Description: OpenPGP digital signature
