diff --git a/src/include/homestore/blk.h b/src/include/homestore/blk.h index 14283cd3e..ac0949e24 100644 --- a/src/include/homestore/blk.h +++ b/src/include/homestore/blk.h @@ -168,6 +168,7 @@ struct blk_alloc_hints { blk_alloc_hints() : desired_temp{0}, dev_id_hint{INVALID_DEV_ID}, + chunk_id_hint{INVALID_CHUNK_ID}, can_look_for_other_chunk{true}, is_contiguous{false}, multiplier{1}, @@ -178,8 +179,8 @@ struct blk_alloc_hints { uint32_t dev_id_hint; // which physical device to pick (hint if any) -1 for don't care bool can_look_for_other_chunk; // If alloc on device not available can I pick other device bool is_contiguous; - uint32_t multiplier; // blks allocated in a blkid should be a multiple of multiplier - uint32_t max_blks_per_entry; // Number of blks on every entry + uint32_t multiplier; // blks allocated in a blkid should be a multiple of multiplier + uint32_t max_blks_per_entry; // Number of blks on every entry uintptr_t stream_info; #ifdef _PRERELEASE bool error_simulate = false; // can error simulate happen diff --git a/src/include/homestore/vchunk.h b/src/include/homestore/vchunk.h index 6f09786f1..e0ac3dcb1 100644 --- a/src/include/homestore/vchunk.h +++ b/src/include/homestore/vchunk.h @@ -24,13 +24,15 @@ class Chunk; class VChunk { public: VChunk(cshared< Chunk > const&); - ~VChunk() = default; + bool operator==(const VChunk&) const; + void set_user_private(const sisl::blob& data); const uint8_t* get_user_private() const; blk_cap_t available_blks() const; uint32_t get_pdev_id() const; + uint16_t get_chunk_id() const; cshared< Chunk > get_internal_chunk() const; private: diff --git a/src/lib/device/vchunk.cpp b/src/lib/device/vchunk.cpp index f47c372ee..dbb19af28 100644 --- a/src/lib/device/vchunk.cpp +++ b/src/lib/device/vchunk.cpp @@ -21,11 +21,15 @@ VChunk::VChunk(cshared< Chunk >& chunk) : m_internal_chunk(chunk) {} void VChunk::set_user_private(const sisl::blob& data) { m_internal_chunk->set_user_private(data); } -const uint8_t* VChunk::get_user_private() const { return m_internal_chunk->user_private(); }; +const uint8_t* VChunk::get_user_private() const { return m_internal_chunk->user_private(); } + +uint16_t VChunk::get_chunk_id() const { return m_internal_chunk->chunk_id(); } blk_cap_t VChunk::available_blks() const { return m_internal_chunk->blk_allocator()->available_blks(); } uint32_t VChunk::get_pdev_id() const { return m_internal_chunk->physical_dev()->pdev_id(); } cshared< Chunk > VChunk::get_internal_chunk() const { return m_internal_chunk; } + +bool VChunk::operator==(const VChunk& vchunk) const { return vchunk.get_chunk_id() == get_chunk_id(); } } // namespace homestore