qcow2: Update l2_allocate() to support L2 slices
commit3861946a5b423b71e677e79cc32c528174bdf9df
authorAlberto Garcia <berto@igalia.com>
Mon, 5 Feb 2018 14:33:17 +0000 (5 16:33 +0200)
committerMax Reitz <mreitz@redhat.com>
Tue, 13 Feb 2018 15:59:59 +0000 (13 16:59 +0100)
tree2e0a5af622962282cbe8270aaaffc7c7097260b5
parent6580bb09ab154143461e9ddc956dee3d81018660
qcow2: Update l2_allocate() to support L2 slices

This patch updates l2_allocate() to support the qcow2 cache returning
L2 slices instead of full L2 tables.

The old code simply gets an L2 table from the cache and initializes it
with zeroes or with the contents of an existing table. With a cache
that returns slices instead of tables the idea remains the same, but
the code must now iterate over all the slices that are contained in an
L2 table.

Since now we're operating with slices the function can no longer
return the newly-allocated table, so it's up to the caller to retrieve
the appropriate L2 slice after calling l2_allocate() (note that with
this patch the caller is still loading full L2 tables, but we'll deal
with that in a separate patch).

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