]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd/migration/NBDStream: be more thorough around nbd_block_status()
authorIlya Dryomov <idryomov@gmail.com>
Sun, 25 Aug 2024 11:10:58 +0000 (13:10 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 6 Sep 2024 12:14:12 +0000 (14:14 +0200)
commitd52bd80f1f9daed51e1cdac142b07fcb9dec8615
tree1c5b95f5050f044087cd904d53eb3378a86a88a3
parentdc8eed68ce58077433e38317f20f3a96ec81f467
librbd/migration/NBDStream: be more thorough around nbd_block_status()

nbd_block_status() is specified to be really loose: it can return
more status (go beyond the requested range), less status (cover only
some part of the requested range) or nothing at all.  The former would
likely violate some assumptions in ObjectCopyRequest, while the latter
would lead to straight data corruption -- parent blocks that weren't
covered would never get copied up into the destination image.

On top of that, the current implementation is very suboptimal.
Because only "nr_entries == 2" responses are effectively processed,
any extent which has a small amount of data and is otherwise zeroed
(e.g. 8K of data in a 4M object) gets listed as DATA.  A copyup for
such an object would write 4M worth of data instead of 8K, consuming
space in the destination image unnecessarily.

Also, it's unclear whether zero-sized entries can be returned.
Currently, if it happens we would hit an assert in interval_map.

This fixes all of these issues.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/librbd/migration/NBDStream.cc