diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:44 +0000 |
commit | 17d6a993fc17d533460c5f40f3908c708e057c18 (patch) | |
tree | 1a3bd93e0ecd74fa02f93a528fe2f87e5314c4b5 /src/librbd/io/Types.h | |
parent | Releasing progress-linux version 18.2.2-0progress7.99u1. (diff) | |
download | ceph-17d6a993fc17d533460c5f40f3908c708e057c18.tar.xz ceph-17d6a993fc17d533460c5f40f3908c708e057c18.zip |
Merging upstream version 18.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/librbd/io/Types.h')
-rw-r--r-- | src/librbd/io/Types.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/librbd/io/Types.h b/src/librbd/io/Types.h index 7c70986c5..03e9ffa3b 100644 --- a/src/librbd/io/Types.h +++ b/src/librbd/io/Types.h @@ -180,8 +180,9 @@ struct SparseExtent { std::ostream& operator<<(std::ostream& os, const SparseExtent& state); struct SparseExtentSplitMerge { - SparseExtent split(uint64_t offset, uint64_t length, SparseExtent &se) const { - return SparseExtent(se.state, se.length); + SparseExtent split(uint64_t offset, uint64_t length, + const SparseExtent& se) const { + return SparseExtent(se.state, length); } bool can_merge(const SparseExtent& left, const SparseExtent& right) const { @@ -232,10 +233,10 @@ struct SparseBufferlistExtent : public SparseExtent { struct SparseBufferlistExtentSplitMerge { SparseBufferlistExtent split(uint64_t offset, uint64_t length, - SparseBufferlistExtent& sbe) const { + const SparseBufferlistExtent& sbe) const { ceph::bufferlist bl; if (sbe.state == SPARSE_EXTENT_STATE_DATA) { - bl.substr_of(bl, offset, length); + bl.substr_of(sbe.bl, offset, length); } return SparseBufferlistExtent(sbe.state, length, std::move(bl)); } @@ -247,14 +248,13 @@ struct SparseBufferlistExtentSplitMerge { SparseBufferlistExtent merge(SparseBufferlistExtent&& left, SparseBufferlistExtent&& right) const { + ceph::bufferlist bl; if (left.state == SPARSE_EXTENT_STATE_DATA) { - ceph::bufferlist bl{std::move(left.bl)}; - bl.claim_append(std::move(right.bl)); - return SparseBufferlistExtent(SPARSE_EXTENT_STATE_DATA, - bl.length(), std::move(bl)); - } else { - return SparseBufferlistExtent(left.state, left.length + right.length, {}); + bl.claim_append(left.bl); + bl.claim_append(right.bl); } + return SparseBufferlistExtent(left.state, left.length + right.length, + std::move(bl)); } uint64_t length(const SparseBufferlistExtent& sbe) const { |