OSDN Git Service

block/rbd: implement bdrv_co_block_status
authorPeter Lieven <pl@kamp.de>
Tue, 12 Oct 2021 15:22:31 +0000 (17:22 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 2 Nov 2021 12:02:46 +0000 (13:02 +0100)
commit0347a8fd4c3faaedf119be04c197804be40a384b
tree9ce45b0efd4246edb1d0c6380ae45d2bcfbc60af
parentbfb8aa6d583b09378dcdb85d40c7951e44acd09f
block/rbd: implement bdrv_co_block_status

the qemu rbd driver currently lacks support for bdrv_co_block_status.
This results mainly in incorrect progress during block operations (e.g.
qemu-img convert with an rbd image as source).

This patch utilizes the rbd_diff_iterate2 call from librbd to detect
allocated and unallocated (all zero areas).

To avoid querying the ceph OSDs for the answer this is only done if
the image has the fast-diff feature which depends on the object-map and
exclusive-lock features. In this case it is guaranteed that the information
is present in memory in the librbd client and thus very fast.

If fast-diff is not available all areas are reported to be allocated
which is the current behaviour if bdrv_co_block_status is not implemented.

Signed-off-by: Peter Lieven <pl@kamp.de>
Message-Id: <20211012152231.24868-1-pl@kamp.de>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/rbd.c