diff options
author | Radoslaw Zarzynski <rzarzyns@redhat.com> | 2024-03-29 17:51:57 +0100 |
---|---|---|
committer | Radoslaw Zarzynski <rzarzyns@redhat.com> | 2024-06-20 22:37:57 +0200 |
commit | 9fcc3bf9016c4192204014ce7303c3193fd05c0e (patch) | |
tree | 61f069bcc4eb6a259fc2165409c8cc4b306c4242 /src/osd/ECUtil.h | |
parent | test/ceph_test_rados: fix seeking over virtual, in-memory objects (diff) | |
download | ceph-9fcc3bf9016c4192204014ce7303c3193fd05c0e.tar.xz ceph-9fcc3bf9016c4192204014ce7303c3193fd05c0e.zip |
osd: fix trimming of multistripe partial reads
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
Diffstat (limited to 'src/osd/ECUtil.h')
-rw-r--r-- | src/osd/ECUtil.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/osd/ECUtil.h b/src/osd/ECUtil.h index af21839da23..c84a87ee380 100644 --- a/src/osd/ECUtil.h +++ b/src/osd/ECUtil.h @@ -106,6 +106,16 @@ public: const auto last_chunk_idx = (chunk_size - 1 + off + len) / chunk_size; return {first_chunk_idx, last_chunk_idx}; } + bool offset_length_is_same_stripe( + uint64_t off, uint64_t len) const { + if (len == 0) { + return true; + } + assert(chunk_size > 0); + const auto first_stripe_idx = off / stripe_width; + const auto last_inc_stripe_idx = (off + len - 1) / stripe_width; + return first_stripe_idx == last_inc_stripe_idx; + } }; int decode( |