]> git.proxmox.com Git - mirror_qemu.git/commit - block/qcow2-cluster.c
qcow2: Add offset_to_l1_index()
authorAlberto Garcia <berto@igalia.com>
Mon, 5 Feb 2018 14:33:12 +0000 (16:33 +0200)
committerMax Reitz <mreitz@redhat.com>
Tue, 13 Feb 2018 15:59:59 +0000 (16:59 +0100)
commit05b5b6ee54cf69e7053c73286aac354be754235e
tree56a7035b7e82c938b36d1c6aaf6b4c89be68ec5e
parent6e6fa7605e8a7c08d873dba9e1688f93aac20fc5
qcow2: Add offset_to_l1_index()

Similar to offset_to_l2_index(), this function returns the index in
the L1 table for a given guest offset. This is only used in a couple
of places and it's not a particularly complex calculation, but it
makes the code a bit more readable.

Although in the qcow2_get_cluster_offset() case the old code was
taking advantage of the l1_bits variable, we're going to get rid of
the other uses of l1_bits in a later patch anyway, so it doesn't make
sense to keep it just for this.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: a5f626fed526b7459a0425fad06d823d18df8522.1517840877.git.berto@igalia.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2-cluster.c
block/qcow2.h