create_base_image() {
local image=$1
- rbd create --size 1G ${image}
+ # size is not a multiple of object size to trigger an edge case in
+ # list-snaps
+ rbd create --size 1025M ${image}
+
rbd bench --io-type write --io-pattern rand --io-size=4K --io-total 256M ${image}
rbd snap create ${image}@1
rbd bench --io-type write --io-pattern rand --io-size=4K --io-total 64M ${image}
#include "librbd/Utils.h"
#include "librbd/io/AioCompletion.h"
#include "librbd/io/ReadResult.h"
+#include "librbd/io/Utils.h"
#include "librbd/migration/SnapshotInterface.h"
#include "librbd/migration/SourceSpecBuilder.h"
#include "librbd/migration/Utils.h"
&previous_size, &sparse_extents);
// build set of data/zeroed extents for the current snapshot
- snapshot->list_snap(io::Extents{image_extents}, list_snaps_flags,
+ auto snapshot_extents = image_extents;
+ io::util::prune_extents(snapshot_extents, snap_info.size);
+ snapshot->list_snap(std::move(snapshot_extents), list_snaps_flags,
&sparse_extents, parent_trace, gather_ctx->new_sub());
}
expect_snapshot_get_info(*mock_snapshot_interface_2, snap_info_2);
io::SparseExtents sparse_extents_2;
sparse_extents_2.insert(0, 32, {io::SPARSE_EXTENT_STATE_DATA, 32});
- expect_snapshot_list_snap(*mock_snapshot_interface_2, {{0, 123}},
+ expect_snapshot_list_snap(*mock_snapshot_interface_2, {{0, 64}},
sparse_extents_2, 0);
expect_snapshot_get_info(*mock_snapshot_interface_head, snap_info_head);