From: Adam Kupczyk Date: Thu, 25 May 2023 19:36:02 +0000 (+0000) Subject: os/bluestore: Add wrappers to access Blob::bc (BufferSpace) X-Git-Tag: v19.0.0~486^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3b0ce557af584db0a4fcceec5ed36d2d7d091ed4;p=ceph.git os/bluestore: Add wrappers to access Blob::bc (BufferSpace) The reason was historical - it was to give one access method to bc regardles where it was defined SharedBlob or Blob. Signed-off-by: Adam Kupczyk --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 67e3a4a534a6..38e554ed2808 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -632,7 +632,7 @@ void _dump_extent_map(CephContext *cct, const BlueStore::ExtentMap &em) << dendl; } std::lock_guard l(e.blob->shared_blob->get_cache()->lock); - for (auto& i : e.blob->bc.buffer_map) { + for (auto& i : e.blob->get_bc().buffer_map) { dout(LogLevelV) << __func__ << " 0x" << std::hex << i.first << "~" << i.second->length << std::dec << " " << *i.second << dendl; @@ -2275,7 +2275,7 @@ void BlueStore::Blob::discard_unallocated(Collection *coll) ceph_assert(discard == all_invalid); // in case of compressed blob all // or none pextents are invalid. if (discard) { - bc.discard(shared_blob->get_cache(), 0, + dirty_bc().discard(shared_blob->get_cache(), 0, get_blob().get_logical_length()); } } else { @@ -2285,7 +2285,7 @@ void BlueStore::Blob::discard_unallocated(Collection *coll) dout(20) << __func__ << " 0x" << std::hex << pos << "~" << e.length << std::dec << dendl; - bc.discard(shared_blob->get_cache(), pos, e.length); + dirty_bc().discard(shared_blob->get_cache(), pos, e.length); } pos += e.length; } @@ -2454,7 +2454,7 @@ void BlueStore::Blob::split(Collection *coll, uint32_t blob_offset, Blob *r) &(r->used_in_blob)); lb.split(blob_offset, rb); - bc.split(shared_blob->get_cache(), blob_offset, r->bc); + dirty_bc().split(shared_blob->get_cache(), blob_offset, r->dirty_bc()); dout(10) << __func__ << " 0x" << std::hex << blob_offset << std::dec << " finish " << *this << dendl; @@ -11021,7 +11021,7 @@ void BlueStore::_read_cache( ready_regions_t cache_res; interval_set cache_interval; - bptr->bc.read( + bptr->dirty_bc().read( bptr->shared_blob->get_cache(), b_off, b_len, cache_res, cache_interval, read_cache_policy); dout(20) << __func__ << " blob " << *bptr << std::hex @@ -11189,7 +11189,7 @@ int BlueStore::_generate_read_result_bl( if (r < 0) return r; if (buffered) { - bptr->bc.did_read(bptr->shared_blob->get_cache(), 0, + bptr->dirty_bc().did_read(bptr->shared_blob->get_cache(), 0, raw_bl); } for (auto& req : r2r) { @@ -11206,7 +11206,7 @@ int BlueStore::_generate_read_result_bl( return -EIO; } if (buffered) { - bptr->bc.did_read(bptr->shared_blob->get_cache(), + bptr->dirty_bc().did_read(bptr->shared_blob->get_cache(), req.r_off, req.bl); } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 18a4ed9ea56b..39babed2f792 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -640,7 +640,7 @@ public: bool can_split() const { std::lock_guard l(shared_blob->get_cache()->lock); // splitting a BufferSpace writing list is too hard; don't try. - return bc.writing.empty() && + return get_bc().writing.empty() && used_in_blob.can_split() && get_blob().can_split(); } @@ -673,6 +673,13 @@ public: return blob; } + inline const BufferSpace& get_bc() const { + return bc; + } + inline BufferSpace& dirty_bc() { + return bc; + } + /// discard buffers for unallocated regions void discard_unallocated(Collection *coll); @@ -2831,7 +2838,7 @@ private: uint64_t offset, ceph::buffer::list& bl, unsigned flags) { - b->bc.write(b->shared_blob->get_cache(), txc->seq, offset, bl, + b->dirty_bc().write(b->shared_blob->get_cache(), txc->seq, offset, bl, flags); txc->blobs_written.insert(b); }