Skip to content

Commit

Permalink
librbd: change remap_extents to lvalue reference
Browse files Browse the repository at this point in the history
This commit changes the remap_extents api to use lvalue instead of ravlue references

Signed-off-by: Or Ozeri <[email protected]>
  • Loading branch information
orozery committed Jan 11, 2021
1 parent 05995ef commit 237eaac
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/librbd/crypto/CryptoImageDispatch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CryptoImageDispatch::CryptoImageDispatch(


void CryptoImageDispatch::remap_extents(
io::Extents&& image_extents, io::ImageExtentsMapType type) {
io::Extents& image_extents, io::ImageExtentsMapType type) {
if (type == io::IMAGE_EXTENTS_MAP_TYPE_LOGICAL_TO_PHYSICAL) {
for (auto& extent: image_extents) {
extent.first += m_data_offset;
Expand Down
2 changes: 1 addition & 1 deletion src/librbd/crypto/CryptoImageDispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class CryptoImageDispatch : public io::ImageDispatchInterface {
return false;
}

void remap_extents(io::Extents&& image_extents,
void remap_extents(io::Extents& image_extents,
io::ImageExtentsMapType type) override;

private:
Expand Down
2 changes: 1 addition & 1 deletion src/librbd/io/ImageDispatchInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct ImageDispatchInterface {

virtual bool invalidate_cache(Context* on_finish) = 0;

virtual void remap_extents(Extents&& image_extents,
virtual void remap_extents(Extents& image_extents,
ImageExtentsMapType type) {}

};
Expand Down
4 changes: 2 additions & 2 deletions src/librbd/io/ImageDispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ void ImageDispatcher<I>::wait_on_writes_unblocked(Context *on_unblocked) {
}

template <typename I>
void ImageDispatcher<I>::remap_extents(Extents&& image_extents,
void ImageDispatcher<I>::remap_extents(Extents& image_extents,
ImageExtentsMapType type) {
auto loop = [&image_extents, type](auto begin, auto end) {
for (auto it = begin; it != end; ++it) {
auto& image_dispatch_meta = it->second;
auto image_dispatch = image_dispatch_meta.dispatch;
image_dispatch->remap_extents(std::move(image_extents), type);
image_dispatch->remap_extents(image_extents, type);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/librbd/io/ImageDispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ImageDispatcher : public Dispatcher<ImageCtxT, ImageDispatcherInterface> {
void unblock_writes() override;
void wait_on_writes_unblocked(Context *on_unblocked) override;

void remap_extents(Extents&& image_extents,
void remap_extents(Extents& image_extents,
ImageExtentsMapType type) override;

protected:
Expand Down
2 changes: 1 addition & 1 deletion src/librbd/io/ImageDispatcherInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct ImageDispatcherInterface
virtual void wait_on_writes_unblocked(Context *on_unblocked) = 0;

virtual void invalidate_cache(Context* on_finish) = 0;
virtual void remap_extents(Extents&& image_extents,
virtual void remap_extents(Extents& image_extents,
ImageExtentsMapType type) = 0;
};

Expand Down
6 changes: 3 additions & 3 deletions src/librbd/io/Utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void file_to_extents(I* image_ctx, uint64_t offset, uint64_t length,
striper::LightweightObjectExtents* object_extents) {
Extents extents = {{offset, length}};
image_ctx->io_image_dispatcher->remap_extents(
std::move(extents), IMAGE_EXTENTS_MAP_TYPE_LOGICAL_TO_PHYSICAL);
extents, IMAGE_EXTENTS_MAP_TYPE_LOGICAL_TO_PHYSICAL);
for (auto [off, len] : extents) {
Striper::file_to_extents(image_ctx->cct, &image_ctx->layout, off, len, 0,
buffer_offset, object_extents);
Expand All @@ -201,7 +201,7 @@ void extent_to_file(I* image_ctx, uint64_t object_no, uint64_t offset,
Striper::extent_to_file(image_ctx->cct, &image_ctx->layout, object_no,
offset, length, extents);
image_ctx->io_image_dispatcher->remap_extents(
std::move(extents), IMAGE_EXTENTS_MAP_TYPE_PHYSICAL_TO_LOGICAL);
extents, IMAGE_EXTENTS_MAP_TYPE_PHYSICAL_TO_LOGICAL);
}

template <typename I>
Expand All @@ -210,7 +210,7 @@ uint64_t get_file_offset(I* image_ctx, uint64_t object_no, uint64_t offset) {
object_no, offset);
Extents extents = {{off, 0}};
image_ctx->io_image_dispatcher->remap_extents(
std::move(extents), IMAGE_EXTENTS_MAP_TYPE_PHYSICAL_TO_LOGICAL);
extents, IMAGE_EXTENTS_MAP_TYPE_PHYSICAL_TO_LOGICAL);
return extents[0].first;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/librbd/mock/io/MockImageDispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct MockImageDispatcher : public ImageDispatcherInterface {
MOCK_METHOD0(unblock_writes, void());
MOCK_METHOD1(wait_on_writes_unblocked, void(Context*));

MOCK_METHOD2(remap_extents, void(Extents&&, ImageExtentsMapType));
MOCK_METHOD2(remap_extents, void(Extents&, ImageExtentsMapType));
};

} // namespace io
Expand Down

0 comments on commit 237eaac

Please sign in to comment.