On 19.05.21 08:11, Vladimir Sementsov-Ogievskiy wrote:
18.05.2021 19:39, Max Reitz wrote:
[...]
> On 17.05.21 14:07, Vladimir Sementsov-Ogievskiy wrote:
[...]
>> Not also, that there is another benefit of such thing:
we'll
>> implement this callback in qcow2 driver, so that backup will read
>> clusters not in guest cluster order, but in host cluster order, to
>> read more sequentially, which should bring better performance on
>> rotating disks.
>
> I’m not exactly sure how you envision this to work, but block_status
> also already gives you the host offset in *map.
>
But block-status doesn't give a possibility to read sequentially. For
this, user should call block-status several times until the whole disk
covered, then sort the segments by host offset. I wonder, could it be
implemented as some iterator, like
read_iter = bdrv_get_sequential_read_iter(source)
while (extents = bdrv_read_next(read_iter)):
for ext in extents:
start_writing_task(target, ext.offset, ext.bytes, ext.qiov)
where bdrv_read_next will read guest data in host-cluster-sequence..
How would you implement this, though? qcow2 doesn’t have a reverse
mapping either, so it too would need to read all L2 table entries and
sort them, wouldn’t it?
Max