Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blkid's serialize api's. #196

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "4.5.2"
version = "4.5.3"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
2 changes: 2 additions & 0 deletions src/include/homestore/blk.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct BlkId {
uint32_t serialized_size() const;
std::string to_string() const;
bool is_valid() const;
static uint32_t expected_serialized_size();

static int compare(BlkId const& one, BlkId const& two);
};
Expand Down Expand Up @@ -131,6 +132,7 @@ struct MultiBlkId : public BlkId {
bool has_room() const;
BlkId to_single_blkid() const;

static uint32_t expected_serialized_size(uint16_t num_pieces);
static int compare(MultiBlkId const& one, MultiBlkId const& two);

struct iterator {
Expand Down
5 changes: 2 additions & 3 deletions src/lib/blkalloc/blk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ uint64_t BlkId::to_integer() const { return *r_cast< const uint64_t* >(&s); }
sisl::blob BlkId::serialize() { return sisl::blob{r_cast< uint8_t* >(&s), sizeof(serialized)}; }

uint32_t BlkId::serialized_size() const { return sizeof(BlkId); }
uint32_t BlkId::expected_serialized_size() { return sizeof(BlkId); }

void BlkId::deserialize(sisl::blob const& b, bool copy) {
serialized* other = r_cast< serialized* >(b.bytes);
Expand Down Expand Up @@ -110,13 +111,11 @@ void MultiBlkId::deserialize(sisl::blob const& b, bool copy) {
}
}

#if 0
static uint32_t MultiBlkId::expected_serialized_size(uint16_t num_pieces) {
uint32_t MultiBlkId::expected_serialized_size(uint16_t num_pieces) {
uint32_t sz = BlkId::expected_serialized_size();
if (num_pieces > 1) { sz += sizeof(uint16_t) + ((num_pieces - 1) * sizeof(chain_blkid)); }
return sz;
}
#endif

uint16_t MultiBlkId::num_pieces() const { return BlkId::is_valid() ? n_addln_piece + 1 : 0; }

Expand Down
2 changes: 1 addition & 1 deletion src/lib/common/resource_mgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ResourceMgr {
std::atomic< int64_t > m_hs_fb_size; // free size
std::atomic< int64_t > m_hs_ab_cnt; // alloc count
std::atomic< int64_t > m_memory_used_in_recovery;
std::atomic< uint32_t > m_flush_dirty_buf_q_depth;
std::atomic< uint32_t > m_flush_dirty_buf_q_depth{64};
uint64_t m_total_cap;
exceed_limit_cb_t m_dirty_buf_exceed_cb;
exceed_limit_cb_t m_free_blks_exceed_cb;
Expand Down
2 changes: 1 addition & 1 deletion src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if (${build_nonio_tests})
target_link_libraries(test_append_blk_allocator homestore ${COMMON_TEST_DEPS} GTest::gmock)
add_test(NAME AppendBlkAlloc COMMAND test_append_blk_allocator)
set_property(TEST AppendBlkAlloc PROPERTY ENVIRONMENT "ASAN_OPTIONS=detect_stack_use_after_return=true")

set(TEST_BLKID_SOURCES test_blkid.cpp ../lib/blkalloc/blk.cpp)
add_executable(test_blkid ${TEST_BLKID_SOURCES})
target_link_libraries(test_blkid ${COMMON_TEST_DEPS} GTest::gtest)
Expand Down